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?
- void automation.Copy_address_from_Contact_to_quotes41(Int id)
- {
- // Haal de Quote gegevens op
- resp = invokeurl
- [
- url :"https://www.zohoapis.eu/crm/v2.1/Quotes/" + id
- type :GET
- connection:"zohocrmfunctions"
- ];
- // info resp;
- soinfo = resp.get("data").get(0);
- ContactID = soinfo.get("Contact_Name").get("id");
- // Haal de Contact gegevens op
- contactresp = invokeurl
- [
- url :"https://www.zohoapis.eu/crm/v2.1/Contacts/" + ContactID
- type :GET
- connection:"zohocrmfunctions"
- ];
- Contactinfo = contactresp.get("data").get(0);
- // Vul adresgegevens uit Contact in Quote
- adressmp = Map();
- adressmp.put("Billing_Street",ifnull(Contactinfo.get("Mailing_Street"),""));
- adressmp.put("Billing_City",ifnull(Contactinfo.get("Mailing_City"),""));
- adressmp.put("Billing_Code",ifnull(Contactinfo.get("Mailing_Zip"),""));
- // Update de Quote met adresgegevens en Lead_Bron
- updatequotes = zoho.crm.updateRecord("Quotes",id,adressmp);
- info updatequotes;
- }
Thanks.
Coen