This handler uses Salesforce's REST API to add a new task to Salesforce. The first thing that the handler does is obtain an access token using the inputted info values, which is used to authenticate the rest of the calls that are made. Next, the handler makes a call to change the requesters email into their user id, which is what is actually used when assigning a task to a user. Then the task is made as a JSON object, with the Subject, Opportunity/Account (opportunity and account cannot be used together), Contact, and Comment values being obtained from the user inputted data. Lastly, that JSON task object that was just created is sent in the body of a REST call to Salesforce, where it is then created and stored in your Salesforce account.
Where to find the Client ID, Client Secret, Security Token and Salesforce Instance.
After logging into Salesforce, the Salesforce Instance can be found in the URL to the left of the salesforce.com (ie. na15, cs13, etc.)
Go to Setup, which is in the dropdown menu under your name in the upper righthand corner.
On the left sidebar, your Security Token can be found under Personal Setup > My Personal Information > Reset My Security Token.
To get the Client ID and Client Secret, Navigate back to Setup and go to Manage Apps.
Create a new Connected App, and fill in the basic information for the app.
Check the Enable OAuth Settings checkbox and put https://auth for your callback url.
Under selected OAuth scopes, add Access and manage your data (api) to your selected scopes and save.
Your Client ID and Client Secret will be found on the app information page that you were redirected to upon saving.
The username/email used to log into Salesforce.
The password used to log into Salesforce.
A security token that is appended onto the end of the password. Can be obtained from Salesforce by going to 'Reset my Security Token' under personal settings.
The client id of the application. Found under Manage Apps in setup.
The client secret of the application. Found under Manage Apps in setup.
Enable debug logging if the value is set to 'Yes'.
Email of the user that the new task will be assigned to.
Subject of the new task.
Test Task Name
Comment for the new task.
Description of the task
The Id of the Contact that this task will be linked with.
The Id of the Account that this task will be linked with (can't be used at the same time as Opportunity Id).
The Id of the Opportunity that this task will be linked with (can't be used at the same time as Account Id).
Id for the newly created Task
Salesforce Task Create V1.2 (2017-09-07)
Due to Salesforce requiring TLS 1.2, this handler is only compatible with Task
4.2.0 and above due to needing a ruby version greater than 2.0.0
Update Salesforce API version from v20.0 to v37.0
Added Task Id as a result
Removed salesforceinstance and added enabledebug_logging as info values
General cleanup of execute() and adding more debug logging