Synchronize Salesforce Cases with ServiceNow Incidents based on Platform Events > Recipe contents > Synchronize Salesforce Cases with ServiceNow Incidents (using Platform Events)
  

Synchronize Salesforce Cases with ServiceNow Incidents (using Platform Events)

When a case is created or updated in Salesforce, a Salesforce platform event triggers the process.
The process checks whether the case contact or case owner matches with the email of the user in ServiceNow. If the user does not exist, the process creates a user in ServiceNow and assigns it as a caller to the ServiceNow incident. The process then searches for a matching incident in ServiceNow by description and creates or updates the incident based on the search results. If the description is modified in the Salesforce case, a new incident is created in ServiceNow with the modified description.
The following image shows the steps that the Synchronize Salesforce Cases with ServiceNow Incidents (using Platform Events) process contains:
The image shows the steps that the Synchronize Salesforce Cases with ServiceNow Incidents (using Platform Events) process contains.
The following table lists the steps that the Synchronize Salesforce Cases with ServiceNow Incidents (using Platform Events) process contains:
Step Name
Description
Start
The event searches for the Salesforce platform event name, that is, the Salesforce connection case.
New/Update Case trigger
Assigns the event details to the case ID and description and triggers the event to verify whether the case was created or updated.
Assign Salesforce Case
Assigns the Salesforce case to a temporary case ID.
Prepare Case Object
Parses the event and assigns values.
Is Subject empty
Verifies whether the case subject is empty. If it is empty, an error occurs, and the process ends. Otherwise, the process continues to the next step.
Is Description empty
Verifies whether the case description is empty. If it is empty, an error occurs, and the process ends. Otherwise, the process continues to the next step.
Get Access Token
Gets an access token to authorize all the connection requests.
Search User in ServiceNow by Email
Searches for the user by email if it is specified in the Salesforce case.
Save User ID
Saves the user ID.
Is User ID missing in ServiceNow
If the user ID is missing in ServiceNow, creates a user in ServiceNow and gets the user ID. Otherwise, the process continues to the next step.
Is Contact in Case set
Searches for the user by email in ServiceNow and saves the owner ID. The process then searches for the owner ID in ServiceNow. If the owner ID is missing in ServiceNow, creates a user as an owner in ServiceNow and gets the owner ID. Otherwise, saves the owner ID.
Search Incident in ServiceNow by Description
Searches for the incident by description in ServiceNow.
Get Incident ID
Gets the incident ID.
Is Incident ID missing in ServiceNow
Verifies whether the incident ID is missing in ServiceNow. If the incident ID exists, updates the incident. Otherwise, creates a new incident.
End
Ends the process.