Subscribe to my full feed.

This is Part 4 of 5 in my series on converting 15-character Salesforce IDs seen in the Salesforce UI into the 18-character IDs seen in results from the Data Loader and API calls. You can start at Part 1 here.

Part 2 covered the Apex code snippets necessary to convert an ID. In this section, we'll cover the Visualforce markup and remaining Apex code to make it all work.

Ironically, even though the entire purpose of this project is to create a Visualforce page to convert IDs, the actual "Visualforce page" was almost no work.

Here is the basic interface:



And the equally simple markup:


It's all Visualforce 101:
1. Enter a value in an inputText field (our 15-char ID)
2. Click the commandButton to call the custom controller code
3. The controller returns the 18-char ID in an outputLabel
4. The outputPanel re-renders so the result is seen by the user

So in addition to the code covered in Part 3, I added getter and setter methods to pass the ID values back and forth, and a pageReference method that responds to the button click. You can check out the final controller code here.

The last step will be to embed the Visualforce page somewhere useful, where my administrators will always have quick and immediate access to it - say, as a custom sidebar component. That - along with a hack to disable developer mode - will be the wrap-up in Part 5.

0 comments:

Post a Comment