Change script to add fields

Change script to add fields

Hi, 

I have a custom function (writen by a different implementation company in the beginning) which I would like to edit to add a different field as well. Can't get it to work on my own though. 

- The script now adds the address fields to a new quote (needs to stay like this)
- Only works when I add new quote from a Deal (which is fine)
- Would like to add the "Lead_Bron" field from the Contacts module.
- The API name in the Quote is "Lead_Source".

Can you help me put this together?

  1. void automation.Copy_address_from_Contact_to_quotes41(Int id)
  2. {
  3. // Haal de Quote gegevens op
  4. resp = invokeurl
  5. [
  6. url :"https://www.zohoapis.eu/crm/v2.1/Quotes/" + id
  7. type :GET
  8. connection:"zohocrmfunctions"
  9. ];
  10. // info resp;
  11. soinfo = resp.get("data").get(0);
  12. ContactID = soinfo.get("Contact_Name").get("id");
  13. // Haal de Contact gegevens op
  14. contactresp = invokeurl
  15. [
  16. url :"https://www.zohoapis.eu/crm/v2.1/Contacts/" + ContactID
  17. type :GET
  18. connection:"zohocrmfunctions"
  19. ];
  20. Contactinfo = contactresp.get("data").get(0);
  21. // Vul adresgegevens uit Contact in Quote
  22. adressmp = Map();
  23. adressmp.put("Billing_Street",ifnull(Contactinfo.get("Mailing_Street"),""));
  24. adressmp.put("Billing_City",ifnull(Contactinfo.get("Mailing_City"),""));
  25. adressmp.put("Billing_Code",ifnull(Contactinfo.get("Mailing_Zip"),""));
  26. // Update de Quote met adresgegevens en Lead_Bron
  27. updatequotes = zoho.crm.updateRecord("Quotes",id,adressmp);
  28. info updatequotes;
  29. }
Thanks. 

Coen