Posts

Showing posts from April, 2016

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 Bu