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
ChrisMcLChrisMcL 

Can I populate a field using an scontrol during edit mode?

I have a lookup field. The user can search in the lookup field like normal, but sometimes they don't know the name. Instead, they have an alternate unique value that they can search in the sidebar, but the search lookup can't use it (because it only searches the name field).
 
To solve this, I can create two additional fields, one to hold the alternate search value and the second one is a formula field created as a hyperlink to run an scontrol to go fill in the lookup field using the alternate value. I know this is possible, but this is multi-stepped and requires the user to save and then click the hyperlink formula and then the screen refreshes.
 
Is there a way to do this in edit mode? What options do I have to:
  • give the user something to click on in edit mode? (eg. like a calendar popup)
  • set lookups to search other than the name field?
  • custom buttons available in edit mode?
  • or any other ideas?

I know it is possible to set fields based on this help text of a solution I've found:

In order to have the value of a lookup field pass through in a custom link, make sure to include both components listed above in the custom link. The field name id is usually appended with a "_lkId". Please make sure to verify this within the html code.

For example, an Account Name lookup field in an Opportunity record will need the following string within the custom link in order for the Account Name to be passed on to the new record the custom link is creating:

opp4={!Account_Name}&opp4_lkid={!Account_ID}


Thanks in advance!

James Wikkerink

Municipal Software

sfdcfoxsfdcfox
You can't have S-Controls in edit mode. You'd need VisualForce do to this in one step. Or you could use Apex Code triggers, or even an outbound message and have a remote server perform the search. As a final attempt, you might simply just use an inline s-control that can figure out if the field should be updated and run automatically. That saves the extra click, but the screen might need to refresh twice in order to show the final updated information.