Hello,
I am looking for a way to copy values from one module to the corresponding fields of another module. I know there are a few articles out there and I found this snippet (I am new to Delug).
So the thing is…
I do have a few custom fields (input fields and dropdowns/picklist) in the Invoice module. There is a lookup field (where I can choose a contact from the Contacts module). The basic thing is, I want to copy a few values from the customer to the corresponding fields in the Invoice module.
So when somebody creates a new Invoice and loads a customer in the lookup field (API name is "Contact_Name") the corresponding values should be loaded from the customer. And if somebody changes certain values in the Contact module (i.e. the address changes etc.), the updated fields should also be loaded into the Invoice module.
Here is an example:
1) Source fields: Contacts module
- Country (API name: Country_Source)
- Street (API name: Mailing_Street)
2) Target fields: Invoice module
- Country (API name: Country_Target)
- Street (API name: Billing_Street)
- reps = zoho.crm.getRecordById("Contacts",conID);
- mp = Map();
- mp.put("Country_Source",ifnull(reps.get("Country_Target"),""));
- mp.put("Mailing_Street",ifnull(reps.get("Billing_Street"),""));
- info "Map :" + mp;
- relCon = zoho.crm.getRelatedRecords("Invoices","Contacts",conID);
- for each con in relCon
- {
- upd = zoho.crm.updateRecord("Invoices",con.get("id"),mp);
- }
I tried to do that with the snippet above (the argument was conID = Contact.Contact-ID). And I did create this workflow function in the Contacts module. But it is not working.
How can I solve the problem?