Search code examples
zohozoho-delugedeluge

How to update the value of variable fetched from JSON using deluge to the field in zoho crm?


Here is the code that I have written to get the required output.

record = zoho.crm.getRecordById("quotes",683769000000338181);
info record;
Exproprice = record.get("Exproprice");
info Exproprice;
Total_Deduction_Item_freebies_Free_copy =  record.get("Total_Deduction_Item_freebies_Free_copy");
info Total_Deduction_Item_freebies_Free_copy;
Total_interest_Amount = record.get("Total_interest_Amount");
info Total_interest_Amount;
Principal_Net_sales = Exproprice - Total_Deduction_Item_freebies_Free_copy -Total_interest_Amount;
info Principal_Net_sales;
//record.put("Principal (Net sales)", "Principal_Net_sales");
//updateResponse = zoho.crm.updateRecord("Quotes", record);
 response = zoho.crm.updateRecord("Quotes",683769000000338181,Principal_Net_sales);

Solution

  • Use this code:

    record = zoho.crm.getRecordById("quotes",683769000000338181);
    info record;
    Exproprice = record.get("Exproprice");
    info Exproprice;
    Total_Deduction_Item_freebies_Free_copy =  record.get("Total_Deduction_Item_freebies_Free_copy");
    info Total_Deduction_Item_freebies_Free_copy;
    Total_interest_Amount = record.get("Total_interest_Amount");
    info Total_interest_Amount;
    Principal_Net_sales = Exproprice - Total_Deduction_Item_freebies_Free_copy -Total_interest_Amount;
    info Principal_Net_sales;
    mp = Map();
    mp.put("Principal_Net_sales", Principal_Net_sales); // Replace Principal_Net_sales with the API name of this field in Quotes module which you can find in Settings > Developer Hub > APIs and SDKs > API Names
    resp = zoho.crm.updateRecord("Quotes", 683769000000338181, mp);
    info resp ;