function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
theoasistheoasis 

Field autofill description

Hey guys,

 

I am looking for a method to autofill a text field when you select from a picklist.  Specifically we'd like to autofill the description field in an event based upon the selection made in the type picklist. 

 

I know that I can use workflow to do a "Field Update" upon saving the event but I would like the field to populate immediately after selecting a value from a picklist - pre-save.   

 

Is this possible?  Any ideas or experiences?

 

Peter

werewolfwerewolf
Unfortunately today your only option to do this is to rewrite the edit page in Visualforce, and use JS in the Visualforce page to set the text field as appropriate.
theoasistheoasis
That makes sense.... wait, can I make a JS "custom link" that dumps text into the description field?  Are there JS conventions that can modify fields?
shillyershillyer

Yes - you can do this with the AJAX Toolkit. Your code could use the API to update the field and the refresh the page. Here's an example using a custom button that you can modify for your needs.

 

Hope that helps,

Sati

ValentinRomelioValentinRomelio

Hi Shillyer (and others),

 

Isnt this solution actualy saving the change to the database?

 

I only want the field on the layout to be updated, not the database.

 

Regards,
Valentino Rijhen

werewolfwerewolf

Right, doing what shillyer suggests would save the change to the database.  As I've said, the only way to make fields on the page change themselves based on context is to write a Visualforce page.