Zoho Partner | ZUPERSTARS mit Z wie ZOHO
Zoho Partner | ZUPERSTARS mit Z wie ZOHO

HOWTO: Create tasks for campaign members in Zoho CRM

12.04.2020 22:27 Kommentar(e) Von Peter Langheinrich

Situation

Many of our customers are using Zoho CRM for account management. One part - e.g. for cross- and upselling - is accomplished by sales campaigns with the built-in campaign module. These campaigns are used for communicating with accounts e.g. regarding a special product or service. Once a campaign is planned by management the tasks are delegated to the sales staff for execution.

Challenge

To be aware of the current work backlog all campaign-related action items should be available as tasks (per campaign member) for the sales staff. As one campaign can consist of > 50 campaign in the same context > 50 campaign tasks would have to be created manually. As of now Zoho CRM does not offer automated functionality to create tasks for campaign members.

Solution

The approach consists of:

  1. Create a button for the campaign screen
  2. The button executes a custom function
  3. The function creates a task for each campaign member
    • Task is connected to the campaign, the contact (= member) and account
    • The task ownership is assigned to the existing member/contact ownership

With the following code snipped the described functionality is accomplished. Please feel free to use, modify, optimize and share it!

campaignDetails = zoho.crm.getRecordById("Campaigns",campaignId);
campaignMembers = zoho.crm.getRelatedRecords('Contacts',"Campaigns",campaignId);
for each  campaignMember in campaignMembers
{
    campaignMemberId = campaignMember.get("id");
    campaignMemberOwner = campaignMember.get("Owner").get("id");
    info campaignMemberOwner;
    crmTaskFieldMap = Map();
    crmTaskFieldMap.put("Subject",concat("Follow-up für Kampagne: ",campaignDetails.get("Campaign_Name")));
    crmTaskFieldMap.put("$se_module","Campaigns");
    crmTaskFieldMap.put("What_Id",campaignId);
    crmTaskFieldMap.put("Who_Id",{"id":campaignMemberId});
    crmTaskFieldMap.put("Owner",campaignMemberOwner);
    crmTaskFieldMap.put("Due Date",today.addDay(3));
    createTask = zoho.crm.createRecord("Tasks",crmTaskFieldMap);
}
return "";

The script gets the campaign members (= connected contacts), loops through them and creates tasks records for each contact.

Next Steps

The script is pretty simple and does exactly what we (and some of our customers) needed. However, there is some potential for future improvement so we share these thoughts:

  • The task information can be completed by adding more information (e.g. due data, priority, some textual information and so on).
  • When you have a campaign with (let's say) 500 members and you hit the button by accident you have 500 tasks you will have to clean. Maybe in this case an undo function would be good or at least a textual information (something like a batch ID) through which a run can be cleaned by filtering the tasks in an easy way and delete them.
  • In a greater context it would be desirable to prioritize (and structure) tasks according to customer value or campaign priority. However, this is a different question and would have to be approached in another context.

Peter Langheinrich

Teilen -