Gonexa University

Initial training


The Gonexa Doc solution is Gonexa's historic solution for generating a document from a template in the format .docx. xlsx .pptx .pdf

Secondary object (custom query)

Custom queries allow you to navigate through the Salesforce object model without necessarily having to do with the original context.

Training prerequisites

  • Have already done a configuration of a main template
  • Have a main object configured


The secondary object makes it possible to obtain a 2nd starting point different from the main object to allow me to search for data in another object that does not have a direct link with my main object.

Example

You are on a main object at the level of a contact, you may need to display the list of current opportunities on the account of the contact in question.

The object model would look like this:

Setting up from the example

#1
Create the secondary object “Account”
  • Go to the “Objects” tab to access the creation of secondary objects
  • Click on “New”
  • Choose the Salesforce object in question [In our case it's “Account"]
  • The label is supplied by default, but you can change it for greater clarity in the model.
  • Write the request to retrieve the ID, this SOQL query allows you to retrieve the record you want.


Recovery request in our example : SELECT AccountId FROM Contact WHERE id = {RecordId}

SELECT AccountId

AccountId is the API name of the specific field on the Contact Object. Attention, if you are on a custom lookup, the field could have been called “Account__c”

FROM Contact

We simply indicate the main object here from which we make the request

WHERE id = {RecordId}

This makes it possible to identify the account that is linked to the contact. The {RecordId} tag should be formalized precisely in this way.

Create the child object of the secondary object “Opportunity”
  • Now click on the Secondary Object
  • You can now create child objects in exactly the same way as from a main object

Sample ID retrieval requests

#2
Primary Purpose is a Quotation and I want to make a Secondary Object the Account


Retrieval request : SELECT AccountId FROM Quote WHERE id = {RecordId}

Primary Purpose is a Training Session and I want to be a Secondary Object: the Account


Retrieval request : SELECT Compte__c FROM Session_Formation__c WHERE id = {RecordId}

💡 L'astuce du Support, prenez Salesforce Inspector pour trouver la requête qui permet de renvoyer le bon record qui correspond à l'objet Principal.