How it works
In this tutorial we are going to set up a workflow and a function that will create a project in Zoho Project, after a deal was modified in Zoho CRM. When a user makes specific changes in Zoho CRM, like updating the deal stage, this will trigger a workflow that will call a function, and this function will create the project, as well as transferring information from the deal.
Pre-requisites
- The deals layout has to be ready, with all fields matching the ones in Zoho Projects. Video: https://youtu.be/UK_MpUnYWvg
- The project layout has to be ready as well, matching Zoho CRM fields. Video: https://youtu.be/Dy6K_fwARGw?t=14
- A template in Zoho Projects has to be created. Video: https://youtu.be/Dy6K_fwARGw?t=126
Optional
This automation will NOT work if the account field on the Deal is empty. You can manually assign an Account, before wining the Deal, or you can create a workflow to do it. If you choose to create a workflow, here are the steps: https://www.blungo.com/blogs/post/workflow-assign-account-to-a-deal-automatically-zoho-crm
Creating the automation
Part 1: Adding a new connection
- In CRM, go to developer space and the to connections
- Click on Add new connection, and select ZohoOAuth
- Connection name: relateproject
- Connection Link name: relateproject
- Scope: choose these two variables: ZohoCRM.modules.ALL, ZohoProjects.projects.ALL, and ZohoProjects.projects.CREATE
- Click on "create and connect", and when a new window pops up, click on "accept"
Part 2: Adding a new function
- In the CRM, go to developers and then functions, and add a new function
- Name it "Create Project" and select automation as the category
- Copy the function listed below and paste in the function window
- Click on "edit arguments", and map the the arguments as shown in the image below the function
- You need to map: ProjName, Description, TemplateID, PortalName as string and id as int
Part 3: Testing the function
- Click on "save and execute"
- In the new dialog, add your parameters:
- ProjName: Any name you want for the project
- Description: Any description
- TemplateID: Open the Zoho Projects template and copy the ID from the URL (ie: https://projects.zoho.com/portal/blungo#todomilestones/1600615000000748888/)
- PortalName: Open Zoho Projects and find it in the URL (ie: https://projects.zoho.com/portal/blungo#todomilestones/1600615000000748888/)
- id: Open a Deal in CRM and copy the Deal ID from the URL
- Click on save
Part 4: Adding custom fields
To find custom fields API names from Zoho Projects, please follow this tutorial: LINK
You can reuse the connection you already created earlier on, or you can create a new connection.
A) Once you have the custom field API names:
- Right after "//custom fields", paste the following function:
- createMap.put("ZOHO_PROJECT_FIELD_API",CRM_FIELD_API);
- Replace "ZOHO_PROJECT_FIELD_API" with the Zoho Project Field API name of the field you want to map
- In the CRM setup, go to "developer space" and the to "APIs"
- Click on "APIs names", and then click on Deals
- Find the field that you want to map, and copy the API name
- Go back to the function, and replace "CRM_FIELD_API" with the API name you just found
- Repeat the same steps for as many fields as you want to map
- createMap.put("ZOHO_PROJECT_FIELD_API",CRM_FIELD_API.toString("MM-dd-yyyy"));
B) Map the arguments
- Click on "edit arguments"
- For each field you want to map, add one argument line
- Copy the "CRM API names" and paste them on the lines you added
- ie: createMap.put("UDF_CHAR1",Zoho_Drive_Folder);
- Select "string" as type, for all of them
- Click on "save"
Finally, save the function by clicking on "Save" on the top right corner.
Part 5: Creating the workflow
- Go to the workflows section and create a new one
- Name it and relate it to the deals module
- When: stage is modified
- Condition: stage is Signed (select any stage you want to trigger this workflow)
- Instant Action: Function
- Click on "functions" and select the function "create project"
- Now click on "configure", and map all the fields (press # for merge field)
- PortalName: find it in the ZohoProjects URL (ie: https://projects.zoho.com/portal/blungo#todomilestones/1600615000000748888/)
- TemplateID: find it in the template URL (ie: https://projects.zoho.com/portal/blungo#todomilestones/160061500000008888/)
- The rest of the fields are merge fields from the CRM, including id, which is the Deal ID
- Click on "save and associate"
- Finally click on Save