Automation Workflows

Automation Workflows

Automating routine tasks is a big and powerful function that can save you time and improve your productivity. RouteIQ helps you do this by configuring workflows. So, in the place of basic check-outs, you can go a step further and:

1. Automatically send an SMS or Email once a stop has been visited.
Eg: When your field agents check-out of a stop, you could automate sending emails with surveys to collect the meeting feedback.

2. Automatically notify your clients via SMS or Email that they'll be visited next, once your agent has checked out of the current stop.
Eg: You can send a heads-up message to the person in your next stop that you just wrapped up your current visit and are heading straight for them now.

This help doc walks you through how it works and how to set it up.

 1. Send an SMS / email to someone at the current stop   
When you check out from a stop, RouteIQ can fetch details of the CRM record linked to that stop (Lead, Contact, or Deal) and use those details to send an SMS or email. This can be done using one of RouteIQ's hidden modules in Zoho CRM called "RIQ Field Visits". Let us see how to do that.

      1. Open the Settings menu in Zoho CRM

      

      2. Select "Workflow Rules" and click "Create rule"





3. Select RIQ Field Visits as the module, enter a rule name and click "Next".



4. Fill in the "When" criteria for the "Check-Out time" field as not empty and click "Done".





5. Choose "Function" in the 'Insert Action' field and click "Configure Function".







6. In the following page, a custom function is displayed. Edit it and add the below arguments and map it accordingly.
    1. String currentStopRecordModuleApiName=#RIQ Field Visits - Associated Record Module API Name

    2. Int currentStopRecordID =#RIQ Field Visits - Associated Record ID





7. Within the function, copy and paste the below snippet of code. This code checks and finds the email field of the record which triggered the workflow.

  1. //Arguments
  2. //currentStopRecordModuleApiName=#RIQ Field Visits - Associated Record Module API Name
  3. //currentStopRecordID =#RIQ Field Visits - Associated Record ID


  4. // Constants
  5. riqFVModApiName = "zrouteiqzcrm__RIQ_Field_Visits";
  6. riqAssociatedModApiName = "zrouteiqzcrm__Associated_Record_Module_API_Name";
  7. riqAssociatedRecID = "zrouteiqzcrm__Associated_Record_ID";
  8. crmModVsFieldApiName = Collection("Leads":"Email","Events":"Email","Contacts":"Email","Accounts":"Email", "Auto_Route_Creation": "Email");
  9. // Getting email ID for the current stop's CRM record
  10. associatedRecordDetails = zoho.crm.getRecordById(currentStopRecordModuleApiName,currentStopRecordID);
  11. fieldName = crmModVsFieldApiName.get(currentStopRecordModuleApiName);
  12. associatedRecordEmail = associatedRecordDetails.get(fieldName);
  13. // Write script to trigger email action below as required
  14. info associatedRecordEmail;
NotesNote: Line 10 needs to have a list of all RIQ integrated modules - api names and their respective email / phone fields - field api name. We recommend adding/removing the values within this collection based on the CRM modules integrated with RouteIQ. Write your own email/SMS triggering logic from line no 16.

8. Click "Save and Associate" and once you're back on the original page, click "Save".

All done! You have now successfully set up a workflow to automate the sending of notifications via email to a contact person in a stop once you check out of it.


Notes
Note: If no association exists: (i.e., the stop was manually added via @places or @favorite places), then no CRM record is available, so no notification is sent.

Example in action:

You check out from a doctor's clinic, and an email is automatically sent.

2. Send an SMS / email to someone at the next stop

Now, let us see how you can do the same to send an SMS or email to intimate the next customer that the field rep is en route to visit them.  

1. Open the Settings menu in Zoho CRM.



2. Select "Workflow Rules" and click "Create rule"





3. Select RIQ Field Visits as the module, enter a rule name and click "Next".



4. Set the workflow to be triggered whenever a record is updated via a specific field. The workflow needs to be triggered every time the field "Check-out Time" is modified to not-empty. Set the workflow rule to be applied for "All RIQ Field Visits" that matches the said condition.





5. Choose "Function" in the 'Insert Action' field and click "Configure Function".






6. In the following page, a custom function is displayed. Edit it and add the below arguments and map it accordingly.
    1. Int recordID = #RIQ Field Visits - RIQ Field Visit Id

    2. Int plannedVisitOrder = #RIQ Field Visits - Planned Visit Order

    3. Int routeID = #Lookup:RIQ Route Name - RIQ Route Id





7. Within the function, copy and paste the below snippet of code. This code checks and finds the email field of the record which triggered the workflow.
  1. //Arguments:
  2. // Int recordID = #RIQ Field Visits - RIQ Field Visit Id
  3. // Int plannedVisitOrder = #RIQ Field Visits - Planned Visit Order
  4. // Int routeID = #Lookup:RIQ Route Name - RIQ Route Id

  5. // Constants
  6. riqFVModApiName = "zrouteiqzcrm__RIQ_Field_Visits";
  7. riqPlanVisitOrder = "zrouteiqzcrm__Planned_Visit_Order";
  8. riqRouteName = "zrouteiqzcrm__RIQ_Route_Name";
  9. riqAssociatedModApiName = "zrouteiqzcrm__Associated_Record_Module_API_Name";
  10. riqAssociatedRecID = "zrouteiqzcrm__Associated_Record_ID";
  11. // Add all RouteIQ integrated module's API name as keys, and respective field API names as values
  12. crmModVsField = Collection("Leads":"Email","Events":"Email","Contacts":"Email","Accounts":"Email","Auto_Route_Creation":"Email");
  13. //Global Variable with the next stop's visit order as plus one
  14. plannedVisitOrderPlusOne = plannedVisitOrder + 1;
  15. plannedVisitOrderPlusOneAsString = plannedVisitOrderPlusOne.toString();
  16. // Getting all Stop Details with the same Route ID and the planned order as plus one
  17. recordSearchCrt = "(" + riqRouteName + ":equals:" + routeID + ") and (" + riqPlanVisitOrder + ":equals:" + plannedVisitOrderPlusOne + ")";
  18. nextStopDetails = zoho.crm.searchRecords(riqFVModApiName,recordSearchCrt);
  19. nextStopDetails = nextStopDetails.get(0);
  20. //Checking if there's a next stop or not
  21. if(nextStopDetails.size() == 0)
  22. {
  23. info "No Next Stop";
  24. }
  25. else
  26. {
  27. //Getting next stop's associated record details
  28. nextStopModuleAPIName = nextStopDetails.get(riqAssociatedModApiName);
  29. nextStopAssociatedRecordID = nextStopDetails.getJSON(riqAssociatedRecID);
  30. //Getting next stop's record details
  31. if(!nextStopAssociatedRecordID.isNull())
  32. {
  33. nextStopRecordDetails = zoho.crm.getRecordById(nextStopModuleAPIName,nextStopAssociatedRecordID);
  34. if(!nextStopRecordDetails.isNull())
  35. {
  36. info nextStopRecordDetails;
  37. nextStopEmail = crmModVsField.get(nextStopModuleAPIName);
  38. //Checking the module, and getting the email value from email field
  39. if(!nextStopEmail.isNull())
  40. {
  41. //Type your mail logic here
  42. info nextStopRecordDetails.get(nextStopEmail);
  43. }
  44. }
  45. }
  46. else
  47. {
  48. info "This is not a CRM Record. It might be a RIQ address record";
  49. }
  50. }
    Notes
    Note: Line 13 needs to have a list of all RIQ integrated modules - api names and their respective email / phone fields - field api names. We recommend adding/removing the values within this collection based on the CRM modules integrated with RouteIQ. Write your own email/SMS triggering logic with content from line no 42.
    8. Click "Save and Associate" and once you're back on the original page, click "Save".


    Example in action

    You check out from Warehouse A refilling your bag with all the supplies you're going to be dropping off today. Automatically, Doctor Johnson (your next stop) receives an email/SMS based on your setup like:
    "Sonia from Rung Pharmaceuticals is on the way.”

    Key Notes  

    • If a stop was added manually using @places or @favorite places (i.e., no CRM record is linked), RouteIQ cannot fetch mobile/email automatically. This is because there is no CRM record for that stop. Hence the workflow will be ignored for that particular case.


    • Notifications can be customized. You can choose the exact SMS/email text when setting up the workflow.


    NotesNote: RouteIQ does not have any SMS / Email vendors in place. To be able to use this function, you have to have an integration setup either through Zoho Marketplace or other vendors of your choice. For further help in this area, please contact support@zohocrm.com and our team will guide you with the process.
    • This helpdoc is an example of how data can be taken advantage of to automate your business processes. Learn more on where and what details does RouteIQ send to Zoho CRM to get an idea on writing your own automations.

    What you can achieve  

    • Saves you time.

    • Reduces scope for human error. Bots never forget, people do. This automation rule helps you overcome the shortcoming with manual notifications.

    • Saves you work. No one wants to do boring tasks that can be done by a bot

    With just a little setup, RouteIQ turns your daily route into a smart, automated workflow that keeps everyone in the loop.