How to prepopulate fields on Standard layout? - Tooling API to the rescue

              Have you ever wondered populating a field's value while creating a new record on a standard detail page?
You can do so by assigning the value to field id. But how do I get the field Id? By grabbing the Id from Inspect Element? If so, then, how do you manage the field ids accross different Salesforce orgs/environments?

We have Tooling API to the rescue.

Use Tooling API when you need fine-grained access to an org’s metadata. Tooling API’s SOQL capabilities for many metadata types allow you to retrieve smaller pieces of metadata.

You can use Tooling API using REST/SOAP. We can also use these  Apex Wrappers & Javascript Wrappers(jsForce).

Thank you very much Andrew Fewcett, James Loghry & Shinchi Tomita for creating these wonderful wrappers! These are awesome, timesaving & very helpful!

Let's get into hands-on in retrieving the field id using JSForce library. In the above example, Bug is a custom object, and Type is a custom field in Bug. I am trying to retrieve the id of Type(CustomField) using Bug(CustomObject)  id.


Comments

  1. Good post .
    http://salesforce-walker.blogspot.in/2015/10/customfield-id-through-tooling-api.html
    it also may be helpful for that.

    ReplyDelete

Post a Comment

Popular posts from this blog

New Beta Architect Certifications by Salesforce

How to deploy Processes in Process builder using ANT?