Zoho creator + zoho books integration

504 Views Asked by At

So been given this recent task, create a form for new customers and integrate it with zoho books.

I know almost nothing about Deluge or zoho platform.

anyway this is what i have achieved so far:

1-Create the form ✅ 2-On form submission->create new contact on zoho books ❌

Here is my form: enter image description here

I managed to create the new contact on zoho books but i am not able to push the last 3 fields to zoho books("Legal Document", "Accounts Document" and "Tax Document").

This last 3 fields have a file attached.

Heres the script:

cpList = List();
firstName = input.Contact_Name.first_name;
lastName = input.Contact_Name.last_name;
contactName = firstName + " " + lastName;
contactMap = Map();
contactMap.put("contact_name",contactName);
contactMap.put("company_name",input.Company_Name);
contactMap.put("website",input.Website);
contactMap.put("twitter",input.Twitter);
/////////
//contactMap.put("skype_name",input.Skype_Name);
billingMap = Map();
billingMap.put("zip",input.Billing_Address.postal_Code);
billingMap.put("country",input.Billing_Address.country);
billingMap.put("address",input.Billing_Address.address_line_1);
billingMap.put("street2",input.Billing_Address.address_line_2);
billingMap.put("city",input.Billing_Address.district_city);
billingMap.put("state",input.Billing_Address.state_province);
contactP = Map();
contactP.put("salutation",input.Contact_Name.prefix);
contactP.put("first_name",firstName);
contactP.put("last_name",lastName);
contactP.put("designation",input.Designation);
contactP.put("department",input.Department);
contactP.put("contact_salutation","Mr/Mrs");
contactP.put("mobile",input.Mobile_Phone);
contactP.put("phone",input.Phone_Number);
contactP.put("email",input.Email);
//Skype does not work here or on the contactMap
//contactP.put("skype_name",input.Skype_Name);
contactP.put("is_primary_contact",true);
contactMap.put("billing_address",billingMap);
// Custom Fields
cpList.add(contactP);
cFields = List();
cFields.add({"index":"1","value":input.Registration_Number});
cFields.add({"index":"2","value":input.Industry});
cFields.add({"index":"3","value":input.VAT});
//next doesn’t work
//cFields.add({"index":"4","value":input.Legal_Form});
cFields.add({"index":"5","value":input.Tax_Dossier_No});
cFields.add({"index":"6","value":input.Legal_Rep_SSN_No});
cFields.add({"index":"7","value":input.Balance_Sheet.toDecimal()});
cFields.add({"index":"8","value":input.Annual_Turnover.toDecimal()});

These are the fields :

//cFields.add({"index":"9","value":input.Legal_Document});
//cFields.add({"index":"10","value":input.Accounts_Document});
//cFields.add({"index":"11","value":input.Tax_Document});

contactMap.put("custom_fields",cFields);
contactMap.put("contact_persons",cpList);
params = Map();
params.put("JSONString",contactMap);
createContact = invokeurl
[
    url :"https://books.zoho.eu/api/v3/contacts?organization_id=..."
    type :POST
    parameters:params
    connection:"..."
];


Somehow, if i dont use the last 3 fields i can add a new contact on zoho books, but if i add the last 3 fields the call is not made, no new contact on zoho books

My issu, how can i upload the files to zoho books?

Thank You

2

There are 2 best solutions below

0
On

You have to create a connection from zoho Oauth. That connection will integrate your creator and books. You have to enable insert from zoho creator to zoho books in that connection.

Put here the connection name in connection webhook. You need must add organization id. createContact = invokeurl [ url :"https://books.zoho.eu/api/v3/contacts?organization_id=..." type :POST parameters:params connection:"..." ];

0
On

The last 3 fields are File type and you must send them as attachements to your invokeurl.