How to create a task or an event in Salesforce (Legacy)
In certain step of the document generation process, you can log activities by creating a task or an event record in Salesforce. This article will instruct you how to:
Convert your template to Advanced Template
Select a step to create new task or new event
Add "create" tag to the logic
Assign an user to be the task / event owner
Relate task or event to other records
Add content to the task or event
Example: Log activity after sending document via email
1. Convert your template to Advanced Template
*Make sure you have completed all the Settings required for the template. This will save your time from editing the options in the logic.
In Settings, select Advanced Template
Select Proceed
Now you are able to customize the logic of the template further
2. Select a step to create new task or new event
Click to open the Main
Select the step that you want to create the new task or log an activity. For example:
To log an activity that the document has been sent via email, scroll to the end step where there is "Send Options- End"
To create a task for revising the document in the future after you have edited it, scroll to the step "Save Options - End"
Click Edit Step in the selected step, for instance in "Send Options - End"
3. Add "create" tag to the logic
In the right pane, click Filter box
Type "create", you will see an create
tag under the SFDC Core Calls library
Hover to the icon in the tag, you will be able to drag and drop it to the logic.
Drag and drop the tag to the logic, in above the "Go to:...". The tag should be on the same level with the "Go to..." and not a child tag of any tag before it.
In the right pane, give the Salesforce Object API in type attribute.
If you want to create a task, type:
Task
If you want to create an event, type:
Event
4. Assign an user to be the task / event owner
Drag and drop field
tag from SFDC Core Calls to the logic, as a child tag of create
In the field
tag attributes in the right pane, give value to the name attribute:
name:
OwnerId
In the value attribute, select the "..." icon to open Data Source
Search for a Salesforce field where you have the id of the user, who you want to have the task assigned to. For example, the task will be assigned to end-user who is creating the document at that time, search for User ID field under the User object
Click to the field, then select Set Attribute
The field API name will be populated in the value attribute
5. Relate task or event to other records
The task or event can be related to another record so that it will appear in the Activities related list of the record. For example, end-user runs Dynamo template to create a document for an Opportunity record. Then the template will create a task for end-users to follow up with that opportunity.
Similar to step 4, drag and drop a field tag as a child tag of the create
In the field
attributes, give value:
name:
WhatId
value: Salesforce field to refer to record ID of the related record, for example:
${Opportunity.Id}
6. Add content to the task or event
You need content to at least fill all the required fields when creating a new task or event. Similar to step 4 and 5, drag and drop more fields tag under the create tag to populate the content. See the table below for field references.
The name attribute: the Salesforce API name of a field in the Task or Event object
The value attribute: the content to be filled in for the mentioned field. Value can be text, dynamic data from other Salesforce fields, result from calculation or a combination of those
Name attribute | Description / | Example of values | Required in Task | Required in Event |
---|---|---|---|---|
OwnerID | Contains the ID of the user who owns the task/ event. Label is Assigned to | ${User.Id} | Required | Required |
Subject | The subject line of the task / event. Label is Subject | Follow-up: ${Opportunity.Name} | Required | Required |
Status | The status of the task, such as In Progress or Completed. Label is Status | Completed | Required | |
Priority | Indicates the importance or urgency of a task, such as high or low. Label is Priority | Normal | ||
WhatID | Record ID of the related object. Label is Related To | ${Opportunity.Id} | ||
WhoID | Record ID of the related Contact or Lead. Label is Name | ${PrimaryContactRole.Contact.Id} | ||
StartDateTime | The start date and time of the event. Label is Start | ${today} | ||
ActivityDate | The event due date. Label is Date | ${today.plusDays(14)} | ||
EndDateTime | The end date and time of the event. Label is End |
For more field references see:
7. Example: Log activity after sending document via email
Whenever end-users send a quotation to an Opportunity, you want to log an activity to the Opportunity record, with information such as:
The day the document has been sent
Email addresses the document has been sent to
The file name of the document
To achieve this requirement, you can follow the instruction above to:
Add create and field tags to the logic on the "Send Option - End" step
Add value to the field tag as the example below
A "Completed" task will be created after the email is sent. End-user will be the task owner. The task is related to the opportunity record in which the document is generated, and referred to the Primary Contact of that opportunity.