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
sornasorna 

Passing a value to a custom field on a standard salesforce page through URL

Hi,

I want to pass a value to a custom picklist field on a standard saleforce page through the URL. So, basically we have to obtain the source id of that field from page source and we can use that id in the URL to map the value. But for a standar field this id will be constant across all the sandbox and prod environments. For ex: let's say for standard Account lookup fields, we have to pass "accid" in the URL. But for a custom field this source id will be different across all environments which force me to hard code those ids in my code and for each sandbox this id is different. Is there a way to avoid hardcoding here?

 

thanks,

Sorna

Shashikant SharmaShashikant Sharma

Hi,

Even though I could not understand your issue completely but I can suggest to you that any id of any control on the page is determined using the id of the parent control as well so if you do not provide that id in that case salesforce generates it. But of you will give id of each control in the hierarchy of that custom field then the id of custom field will remain same for all the orgs. You can also use $Component.customfieldsID , this will also give you id of that field.

sornasorna

I got what you are saying. If it is a VF page, then I can give the id for an element which will be constant for all environments. But I want to get the id of a field in a standard saleforce page.

 

Thanks,

Sorna

_Prasu__Prasu_

Standard fields will have same id across all type of instances. I dont think you can do same thing with the custom fields. As id for them are somewhat like Salesforce ID, that means they get generated once fields are created and added to metadata of instance and same id is used as a reference. 

 

So I guess there is no  way for custom field and to avoid that hardcode.

sornasorna

Thanks Prasanna. Actually I was trying to find out some javascript code which may pull the custom field's source id from a std salesforce page. But it does not seem to work. So, I think hardcoding is the only way to do it.

 

thanks again,

Sorna