This tutorial shows how you can add a Salesforce account and store the account ID on the ticket for update purpose.
Assumption
- That you have a connected App if not see Setup Salesforce Connected App and API user for the integration
- That you have an OAuth authentication setup Setup OAuth to Salesforce
Steps
- Create a new Action by clicking
buttonStatus colour Blue title Create - Enter a name: Add Saleforce Account and click
Status colour Blue title Create - Select Method:
and URL:https://yourInstance.salesforce.com/services/data/v20.0/sobjects/Account/Status colour Yellow title POST
From the Saleforce REST API we can read that to add an account we need to call POST https://yourInstance.salesforce.com/services/data/v20.0/sobjects/Account/ - Select Authentication method: Salesforce (OAuth)
- Add request headers, key: Content-Type with value application/json
On the Body section add the following
Code Block { "name":"{{issue.reporter.username}}" }
Here we use the mustache syntax to grab the user name of the reporter.
- Click Triggers tab
- Select
event, in this example we will use the Issue Resolved event to indicate that the user shall be added.Status colour Green title Issue RESOLVED - On JQL Condition. When to execute the event(s) write Project = TESTB and to limit the trigger to the TESTB project
- Click
Status colour Blue title SAVE - (Optional) Click Test button (no issue key is needed) to and click Send, Then go 3 - View Execution Log.
The result will have a response like the one below:
Code Block |
---|
{ "nameid": "Warehouse0012o00002fDp8OAAS", "selfsuccess": "http://localhost/rest/api/2/group?groupname=Warehouse"true, "users": { "size": 2, "items "errors": [], "max-results": 50, "start-index": 0, "end-index": 0 }, "expand": "users" } |
Optional steps to inform the reporter about being added are to create a chained action that comments the issue.