The Salesforce API App (Connector} can be used to trigger an Logic App.
It will fire the trigger on a New record or an Update to a record.
In actually it is a polling process. It defaults to one hour for the Basic Service Plan.,
In order to debug and test you will need to upgrade the Standard Service Plan. This will allow you to set the trigger to one minute.
I am working on a project where I needed to synchronize records between CRMOL and Salesforce.
I needed to sync the parent record and several custom child records. I needed to create two Logic Apps for each record type, one for Insert and the other Update.
I ran into some issues with the way the Salesforce App works.
You would assume that you would get a trigger for New Records and another for Update Records. But that’s not what was happening.
This is how it works
- Create a new Parent record fires the Insert and update a Parent record fires the Update.
- Create the first Child Record of one type, fires both Insert Child and Update Parent
- Create the more Child Records of one type, fires both Update Child and Update Parent
- Update the Parent record, fires Update Parent.
- Update a child record, fires both Update Parent and Update child
The issue was that I need to Insert and Update the same type of records in CRMOL.
In order to do an update, I needed the Parent Record Id from CRMOL. This works fine for updates. But doesn’t work for new records that are being inserted as a Update.
To solve the problem I need to insert a Get action right after the trigger fired. I need to query the Parent records for the Id that I needed to do the update with. Then I need to create an expression that wouldn’t return a run-time error if the field did not exist. The following code sample shows the expression.
"expression": "@or(equals(not(empty(body('Get_PrescriberAccountId')?['CRM_HUB_ID__c']))), equals(not(empty(triggerBody()?['CRM_HUB_ID__c']))))"
I am starting end-to-end testing shortly. I am sure 🙄 that I will discover more issues to contend with.