1
0
-1

The following documentation refers to the includeFields directive, where each item specifies the field name, not the label of the field:

How to configure a Transact Prefill Generator in Salesforce

If I'm building a new Prefill Generator for a new form, and wish to include new fields which aren't specifically documented in the above, how do I extract the field names out of SalesForce?

For example, the Mailing Address is made up of multiple fields, and I'm not sure how to declare them in the Prefill Generator Config.

    CommentAdd your comment...

    1 answer

    1.  
      2
      1
      0

      Go to the Setup menu (top right):

       

      In the quick search at the top of the left menu enter the object name you are accessing (e.g. Contact):

      Under Customize you will see the name of the object you are accessing and a Fields sub menu item. Click this and the table that lists the fields contains the Field Name.

      You may need Admin profile to access this information.

      1. Sacha Trube

        This is good. One more question: Is the prefill processor capable of extracting individual fields from complex data types? <MailingAddress>System.Address[getCity=Manly;getCountry=Australia;getCountryCode=null;getGeocodeAccuracy=null;getPostalCode=2093;getState=NSW;getStateCode=null;getStreet=Level 2, 1A Rialto Ln;]</MailingAddress> ... if so, what is the syntax to declare it in the JSON config? Otherwise, this will need to be processed in-form as a rule.

      2. Ben Warner

        Yes, actually you have to take the individual fields as the processor won't read the complex type. This should help: https://developer.salesforce.com/docs/atlas.en-us.api.meta/api/compound_fields_address.htm

      3. Sacha Trube

        I will convert this to another question, but I ended up coming up with this script which seems to work: if (Util.isBlank(data.addressLine1) ){ var addressString = data.sfmailingaddress.split(/[\[\]]/)[1] // getCity=Manly;getCountry=Australia;getCountryCode=null;getGeocodeAccuracy=null;getPostalCode=2093;getState=NSW;getStateCode=null;getStreet=Level 2, 1A Rialto Ln; var addressVarsArr = addressString.split(";") // [0] == getCity=Manly var addressObj = {} var itemArr = "" for (var i = 0; i < addressVarsArr.length; i++) { itemArr = addressVarsArr[i].split("=") addressObj[itemArr[0]] = itemArr[1] } data.addressLine1 = addressObj.getStreet.split(/\r/)[0] data.addressLine2 = addressObj.getStreet.split(/\r/)[1] data.city = addressObj.getCity data.state = addressObj.getState data.postCode = addressObj.getPostalCode }

      CommentAdd your comment...