Take the 2-minute tour ×
Salesforce Stack Exchange is a question and answer site for Salesforce administrators, implementation experts, developers and anybody in-between. It's 100% free, no registration required.

I'm trying to pre-populate fields on a custom object that I made. I tried passing the values through the url using a button link, overriding the default new button and providing the ids of the fields on that page, which works in my original org. However when migrating the changes to another org, the ids don't sync up, causing the fields not to populate.

Is there an easy way to pass arguments through the url more generically, other than hard coding values to page element ids?

share|improve this question
    
Have you tried using Merge Fields in place of Ids? –  Sanjay Jun 17 at 16:54
    
I have not tried merge fields. The solution I used is here threeheadsonapike.wordpress.com/2013/02/11/… –  Andrew Jun 17 at 20:47

1 Answer 1

You cannot query Field Id because that is not accessible in SOQL. Hence, there is no generic solution to avoid the hardcoding.

However, you can utilize Tooling API in Salesforce to query CustomObject Id and CustomField Id. But I am not sure if we can use Tooling API inside a Custom button. See this and work it out. Let us know if you find a feasible solution using the link.

share|improve this answer
    
I was looking for something less invasive, but I did try out the solution on this page. threeheadsonapike.wordpress.com/2013/02/11/…. Just added the files into my dev org and it worked right away. I have yet to look into your link too extensively. –  Andrew Jun 17 at 19:07
    
I saw your blog and good work buddy. You could also have shared few screenshots for demonstration. –  the_phantom Jun 17 at 20:01

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.