How to create a lookup relationship in Salesforce via Good Grants integrations
To create a Lookup field in Salesforce based on data passed from Good Grants, there needs to be a known identifier. Here's how to do it:
If you have two objects in Salesforce where you need specific records in those objects to related to each other, you need to have a lookup field in one of those Salesforce objects (the latter one).
To achieve this lookup relationship using Good Grants integrations, you must have two integration steps in Good Grants where one has a dependency on the other. This approach allows an ID to be shared from one integration to the next. We capture this ID in a dedicated variable called {id} which is sent back from Salesforce once the first integration step has completed.
Scenario: to relate a contact record with an application record in Salesforce
- Your Salesforce objects may be named differently from the examples in this article
- We're using custom object Salesforce API naming conventions for all Salesforce objects in this article.
- For this example, we're working exclusively with the action of an application being submitted. In a Good Grants integration, this is the Application information section of an integration.
First, you need to have two objects in Salesforce, for example, Contact and Application. Let's call these SF_contact__c and SF_application__c.
Both of these objects will have their own unique fields, however, the SF_application__c object must have a Lookup field pointing at the field value where the email address (i.e unique identifier) is stored in the SF_contact__c object. Let's call this Lookup field Applicant_email__c.
Then, in Good Grants, you will need two integrations, one for creating/updating a record in the SF_contact__c object, the other for creating/updating a record in the SF_application__c object. Let's call these Good Grants integrations "GG Contact" and "GG Application".
Step 1: create a contact record with email as the unique identifier
From Good Grants, you have a dedicated and authenticated Salesforce integration that triggers when an application has been successfully submitted. The unique identifier in the "GG Contact" integration is the applicant's email address. The email address is used to find the record in the SF_contact__c object and if it exists, the record is updated, if it does not exist, the record is created.
Once the SF_contact__c record has been successfully created, Salesforce sends back an ID in the variable {id} which is the unique identifier (i.e the email address).
Step 2: create an application record with the application slug being the unique identifier and pairing {id} with your lookup field
Once the first integration step has completed the next dependency integration will trigger. At this time the GG Application integration is creating a new record in the SF_application__c object using the Application slug as the unique identifier. As part of this integration's field pairing, you need to add {id} into Applicant_email__c (i.e the Lookup field) in the SF_application__c object which is done at the very bottom of the Application information section in the integration, you will need to add a new CRM field pairing.
Once this is done, you should be able to run a test where you submit an application in Good Grants and, as a result of this, you will have two records created in your Salesforce account, one in the SF_contact__c object and one in the SF_application__c object where both records relate to each other.