Automatically create a project when deal is won (Zoho Projects and CRM)

11/30/2023 03:31 PM - Comment(s) - By Jesus Sosa

Pre-requisites

1.  The deals layout has to be ready, with all fields matching the ones in Zoho Projects. 

2.  The project layout has to be ready as well, matching Zoho CRM fields. 

3.  A template in Zoho Projects has to be created. 

 

Part 1: Adding a new connection

1.  In CRM, go to developer space and the to connections

2.  Click on Add new connection, and select ZohoOAuth

3.  Connection name: zcrm_zproject

4.  Connection Link name: zcrm_zproject

5.  Scope: choose these two variables: ZohoCRM.modules.ALL, ZohoProjects.projects.ALL, and ZohoProjects.projects.CREATE

6.  Click on "create and connect", and when a new window pops up, click on "accept"



Part 2: Adding a new function

1.  In the CRM, go to developers and then functions, and add a new function

2.  Name it "Create Project Automation" and select automation as the category

3.  Copy the function listed below and paste in the function window

4.  Click on "edit arguments", and map the the arguments as shown in the image below the function

You need to map: Project_Name, Description, TemplateID, PortalName as string and id as int

createMap = Map();

createMap.put("name",Project_Name);

createMap.put("description",Description);

createMap.put("template_id",TemplateID);

//custom fields

//end of custom fields

response = zoho.projects.createProject(PortalName,createMap,"");

info response;

mp = Map();

mp.put("name",);

datalist = List();

datalist.add(mp);

datamp = Map();

datamp.put("data",datalist);

resp2 = invokeurl

[

url :"https://www.zohoapis.com/crm/v2/Deals/" + id + "/Zoho_Projects/" + response.getJSON("projects").getJSON("id")

type :POST

parameters:datamp.toString()

connection:""

];

info resp2;

 

Part 3: Testing the function: Testing the function

1.  Click on "save and execute"

2.  In the new dialog, add your parameters:

1.  ProjName: Any name you want for the project

2.  Description: Any description

3.  TemplateID: Open the Zoho Projects template and copy the ID from the URL (ie: https://projects.zoho.com/portal/#todomilestones/140061500000008877/)

4.  PortalName: Open Zoho Projects and find it in the URL (ie: https://projects.zoho.com/portal/#todomilestones/140061500000008877/)

#todomilestones/1600615000000748888/)

5.  id: Open a Deal in CRM and copy the Deal ID from the URL

3.  Click on save

 

Part 4: Adding custom fields: 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:

1.  Right after "//custom fields", paste the following function:

· createMap.put("ZOHO_PROJECT_FIELD_API",CRM_FIELD_API);

2.  Replace "ZOHO_PROJECT_FIELD_API" with the Zoho Project Field API name of the field you want to map

3.  In the CRM setup, go to "developer space" and the to "APIs"

1.  Click on "APIs names", and then click on Deals

2.  Find the field that you want to map, and copy the API name

4.  Go back to the function, and replace "CRM_FIELD_API" with the API name you just found

5.  Repeat the same steps for as many fields as you want to map

Note: to map a date field, you have to use the following function:

·  createMap.put("ZOHO_PROJECT_FIELD_API",CRM_FIELD_API.toString("MM-dd-yyyy"));

B) Map the arguments

1.  Click on "edit arguments"

2.  For each field you want to map, add one argument line

3.  Copy the "CRM API names" and paste them on the lines you added

1.  ie: createMap.put("UDF_CHAR1",Zoho_Drive_Folder);Zoho_Drive_Folder);

4.  Select "string" as type, for all of them

5.  Click on "save"

Finally, save the function by clicking on "Save" on the top right corner.

Part 5: Creating the workflow: Creating the workflow

1.  Go to the workflows section and create a new one

2.  Name it and relate it to the deals module

3.  When: stage is modified

4.  Condition: stage is Signed (select any stage you want to trigger this workflow)

5.  Instant Action: Function

6.  Click on "functions" and select the function "create project"

7.  Now click on "configure", and map all the fields (press # for merge field)

1.  PortalName: find it in the ZohoProjects URL (ie: https://projects.zoho.com/portal/expressautomationsolutions#todomilestones/140061500000008877/)

#todomilestones/1600615000000748888/)

2.  TemplateID: find it in the template URL (ie: https://projects.zoho.com/portal/#todomilestones/140061500000008877/)

/)

3.  The rest of the fields are merge fields from the CRM, including id, which is the Deal ID

8.  Click on "save and associate"

9.  Finally click on Save

 

Now refresh the deal you want to test this automation on and move it to the signed stage. The new project should be created automatically in Zoho Projects, and all the fields from the CRM should be copied to the fields in Projects. Also the project should be linked to the CRM in the projects section.

 

Jesus Sosa

Share -