Synchronize Salesforce Contacts with Database Contacts > Synchronize Salesforce Contacts with Database Contacts recipe overview > Prerequisites for configuring a Salesforce Platform Event to subscribe to Contact object creation or change
  

Prerequisites for configuring a Salesforce Platform Event to subscribe to Contact object creation or change

Salesforce connections in Application Integration support the Salesforce Streaming API. You can configure an event source in a Salesforce connection to subscribe to Salesforce platform events and PushTopic queries. You can use the event source in a process to consume changes in real-time.
For more information about setting up Salesforce platform events, see the Informatica Knowledge Base article 000181147.
To set up the Salesforce platform event to subscribe to Contact object creation or change, perform the following steps:
Step 1: Create a platform event
Step 2: Create a new connected app
Step 3: Set object permissions
Step 4: Create a trigger to generate an event

Create a platform event

To create a platform event in Salesforce, perform the following steps:
    1 Log in to the Salesforce organization.
    2Go to Setup > Develop > Platform Events, and then click New Platform Event.
    The following image shows the New Platform Event button and the platform event name on the Platform Events page:
    The image shows the New Platform Event button and the platform event name on the Platform Events page.
    3In the Platform Event Information section, enter the details in the Label, Plural Label, and Object Name fields, and select Publish Immediately in the Publish Behavior field as shown in the following image:
    The image shows the Platform Event Information section to enter the values in the Label, Plural Label, Object Name, and Publish Behavior fields.
    4Click Save.
    The Salesforce platform event is created successfully. Note the API Name field value. You will need to enter it in the Event Consumer field while configuring the Salesforce connection.
    5 Open the Salesforce platform event that you just created.
    6In the Custom Field & Relationships section, add the custom fields named Email__c, First_Name__c, Id__c, Last_Name__c, and Phone__c with the Text data type.
    The following image shows the API name and the fields that you created in the Salesforce platform event:
    The image shows the API name and the fields that you created in the Salesforce platform event.

Create a new connected app

In the connected app, you provide the necessary permissions and consume the platform event. From this connected app, you will get the consumer key and consumer secret that you will need while configuring the Salesforce connection.
    1Go to Setup > Build > Create > Apps > Connected Apps, and then click New.
    The following image shows the New button in the Connected Apps section on the Apps page:
    The image shows the New button in the Connected Apps section on the Apps page.
    2Enter the details in the Connected App Name, API Name, and Contact Email fields.
    3Select the Enable OAuth Settings option.
    4In the Callback URL field, enter the callback URL as shown in the following format:
    https://<pod name>.informaticacloud.com/login/callback
    5Provide the necessary access in the Selected OAuth Scopes field. If you are not sure about the access, select all the options from the Available OAuth Scopes section, and click Add.
    The selected options are displayed in the Selected OAuth Scopes section.
    The following image shows the Connected App Name page:
    The image shows the Connected App Name page.
    6Click Save.
    7Go to the API (Enable OAuth Settings) section and click Manage Consumer Details as shown in the following image:
    The image shows the Manage Consumer Details button in the API (Enable OAuth Settings) section.
    The Consumer Key and Consumer Secret fields are displayed.
    8Save the consumer key and consumer secret values for your future use.
    9Click Manage > Edit policies > IP Relaxation.
    The following image shows the IP Relaxation field in the Connected App Edit page:
    The image shows the IP Relaxation field in the Connected App Edit page.
    10Select Relax IP restrictions in the IP Relaxation field.
    11Click Save.

Set object permissions

To set up the platform event with the necessary permissions, perform the following steps:
    1Go to Setup > Manage Users > Profiles, and then click Edit next to the profile name, or if you are not sure, click Edit next to All Profiles.
    The following image shows the list of profiles on the Profiles page:
    The image shows the list of profiles on the Profiles page.
    2In the Select Columns to Display section, select Object Permissions in the Search field.
    3In the Available Settings section, select the platform event that you just created.
    4 Add all the required permissions.
    The following image shows the settings in the Select Columns to Display section:
    The image shows the settings in the Select Columns to Display section.
    5Click Save.
    You can use this platform event in the Salesforce connection in Application Integration, and the Salesforce connection can be used in a real-time process to consume Salesforce events.

Create a trigger to generate an event

To create a trigger to generate an event, perform the following steps:
Note: Informatica recommends that you use the Salesforce Lightning Experience as Salesforce plans to retire Process Builder and recommends building automation in Flow Builder.
    1Go to Setup > Process Automation > Flows, and then click New Flow.
    The following image shows the list of flows on the Flows page:
    The image shows the list of flows on the Flows page.
    2Select Record-Triggered Flow.
    The following image shows the Record-Triggered Flow option on the New Flow dialog box:
    The image shows the Record-Triggered Flow option on the New Flow dialog box.
    3Click Create.
    4In the Object field, select the object as Contact.
    5In the Configure Trigger section, select the A record is created or updated option.
    The following image shows the Flow Builder page:
    The image shows the Flow Builder page.
    6Add a new element in the flow builder space, Data > Create Records.
    7Enter values in the Label and API Name fields.
    8In the How Many Records to Create field, select One.
    9In the How to Set the Record Fields field, select Use separate resources, and literal values.
    10In the Create a Record of This Object section, enter the name of the Salesforce platform event you created in the Object field.
    11In the Set Field Values for the ContactPE field, map the fields in the Salesforce platform event using the {!$Record} in the Value field.
    The following image shows the Set Field Values for the ContactPE field where you can map the fields in the Salesforce platform event using the {!$Record} in the Value field:
    The image shows the Set Field Values for the ContactPE field where you can map the fields in the Salesforce platform event using the {!$Record} in the Value field.
    12Click Save and Activate.
    After completing these steps, you have the event consumer, consumer key, and consumer secret values for setting up the Salesforce connection in Application Integration.