Configure Salesforce
From Salesforce Admin: Setup → Platform Tools → Apps → Connected Apps → Manage Connected Apps. Create a New Connected App 'ProcessMaker Demo'
Take note of Consumer Key and Consumer Secret at API (Enable OAUTH Settings)
Edit Callback URL with that of PM instance making the calls (i.e. https://poc32.processmaker.com/plugin/pmConnectors/oauth/callback.php)
Configure ProcessMaker
- From PM Admin: PM Connectors → Authentication Configuration. Create New Configuration 'Salesforce'
- Procotol: Oauth2
- Sub-protocol: Authorization Code
- authorizationUri: https://na50.salesforce.com/services/oauth2/authorize (replace with actual SF instance)
- tokenCredentialUri: https://na50.salesforce.com/services/oauth2/token (replace with actual SF instance)
- redirectUri: must be exact as SF Callback URL above 1.c
- cliendId and clientSecret, as provided by SF Connected App above 1.b
- All other fields as default
- Get Access Token: Press to get token before connecting. This token expires fairly quickly. Must revise/renew prior to each demo session.
- From PM Admin: PM Connectors → Services. Create New Service 'Salesforce' with Authentication Configuration Salesforce created above 2.a.
- From PM Admin: PM Connectors → Connectors. Create Connectors as needed:
- Method: GET
URL:
unmigrated-wiki-markuphttps://na50.salesforce.com/services/data/v20.0/query/?q=SELECT+Name,Phone,Email,Title,SuiteCreated__c,SuiteUser__c,AccountId+from+Contact+WHERE+id+=+'{SFcontactId}'
- This example URL call uses SF API v20.0 to request various Contact fields using a Path Parameter Variable SFcontactId
The expected query string follows SF SOQL formatting. Full reference here: https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest/resources_query.htm
- From PM Admin: PM Connectors → Authentication Configuration. Create New Configuration 'Salesforce'
- In-Process Use
- Save Parameter variables in @@ Vars as needed.
- Call the Connectors with Service Tasks. Feed the Path Parameters with the appropriate Vars.
- Define the Response Mapping as Variables.
- @@returnMessage : message→records
- @@code : code
- Capture the response messages after the Service Task, as Array values within a Trigger. For the example SOQL above:
@@returnName = @&returnMessage[0]->Name;
@@returnTitle = @&returnMessage[0]->Title;
@@returnEmail = @&returnMessage[0]->Email;
@@returnPhone = @&returnMessage[0]->Phone;
@@returnOwner = @&returnMessage[0]->SuiteUser__c;
@@returnDate = @&returnMessage[0]->SuiteCreated__c;
@@returnAccountId = @&returnMessage[0]->AccountId;
...