Associate or Link Zoho Project with Deal via Integration Related List

Automatically Associate or Link Zoho Project with Deal via related list using deluge script

In this Blog post, we know about the process of how we can associate the Project which created in Zoho Project Application using Deluge script with Zoho CRM Deal module Record.

Please Find the below Steps:-

1.Go to the Setting icon,Navigate the Marketplace Section

2.Click on Zoho,Select Zoho Project Application & click on Setup now button to Integrate the Zoho Project with Zoho CRM Successfully.

 Please find the below Deluge snippet:-

getDeal = zoho.crm.getRecordById("Deals",Dealid);

project_name = ifnull(getDeal.get("Deal_Name"),"");

mp = Map();

mp.put("name",project_name);

// mp.put("owner_id","60026062637");

mp.put("owner_zpuid","205165000000032021");

//shikhar

mp.put("start_date",zoho.currentdate.toString("MM-dd-yyyy"));

mp.put("end_date",zoho.currentdate.addDay(3).toString("MM-dd-yyyy"));

mp.put("UDF_CHAR1",ifnull(getDeal.get("Estimated_Target_BOM"),""));

//Estimated Target BOM

mp.put("UDF_CHAR2",ifnull(getDeal.get("Reason_for_change"),""));

mp.put("UDF_LONG1",ifnull(getDeal.get("Maximum_no_of_SKU_s").toNumber(),""));

//maximum_no_of_parts

mp.put("UDF_CHAR3",ifnull(getDeal.get("Current_packing_material"),""));

mp.put("UDF_CHAR4",ifnull(getDeal.get("Box_Dimensions"),""));

//box dimension

mp.put("UDF_CHAR5",ifnull(getDeal.get("Product_Dimensions"),""));

mp.put("UDF_CHAR6",ifnull(getDeal.get("Projections"),""));

//no_of_repeat_orders

mp.put("UDF_CHAR7",ifnull(getDeal.get("Customer_Interest_Level"),""));

//customer_interest_level

if(!isNull(getDeal.get("Projection_Date")))

{

mp.put("UDF_DATE1",ifnull(getDeal.get("Projection_Date").toString("MM-dd-yyyy"),""));

info getDeal.get("Projection_Date").toDate();

}

//repeat_order_date

mp.put("UDF_CHAR8",ifnull(getDeal.get("No_of_Stacks"),""));

//no_of_stacks

mp.put("UDF_CHAR9",ifnull(getDeal.get("Projection_Term"),""));

//repeat_frequency

mp.put("UDF_CHAR10",ifnull(getDeal.get("Product_weight"),""));

//product_weight

mp.put("UDF_CHAR11",ifnull(getDeal.get("Design_Project"),""));

//product_category

mp.put("UDF_CHAR12",ifnull(getDeal.get("Sample_available"),""));

//sample_available

mp.put("UDF_CHAR13",ifnull(getDeal.get("Product_Model"),""));

//product_model

mp.put("UDF_CHAR14",ifnull(getDeal.get("Quality_Testing_Criteria").toList(","),""));

//quality_testing_criteria

mp.put("UDF_CHAR15",ifnull(getDeal.get("Product_Code"),""));

if(!isNull(getDeal.get("Drop_Test_Height_mm")))

{

mp.put("UDF_LONG2",ifnull(getDeal.get("Drop_Test_Height_mm").toLong(),""));

}

mp.put("template_id",205165000000096005);

//Concept Drawing New

portalname = "honecoredotcom";

portalID = "60025983370";

projectsAPIEndPoint = "https://projectsapi.zoho.in/restapi";

url = projectsAPIEndPoint + "/portal/" + portalID + "/projects/";

resp = invokeurl

[

url :url

type :POST

parameters:mp

connection:"zcrm"

];

// info resp;

projectid = resp.getJSON("projects");

for each  rec in projectid

{

projid = rec.get("id");

projname = rec.get("name");

}

up_deal = zoho.crm.updateRecord("Deals",Dealid.toLong(),{"Zoho_Project_ID":projid.toString()});

//project id update into Deal module 

info up_deal;

/*Linking project record with deal record via integration related list section */

mp = Map();

mp.put("name",projname);

contdet = Map();

contdet.put("id",Dealid);

mp.put("Deals",Dealid);

datalist = List();

datalist.add(mp);

datamp = Map();

datamp.put("data",datalist);

resp_deal = invokeurl

[

url :" https://www.zohoapis.in/crm/v2/Deals/" + Dealid.toLong() + "/Zoho_Projects/" + projid.tostring()

type :POST

parameters:datamp.toString()

connection:"z_projects"

];

info "Cont Association : " + resp_deal;



Post a Comment