So i recently started working with the Zoho platform so im quite new to it, ive been assigned the following task:
Build a Customer form on zoho creator with various different fields (name, company name, billing address and some extra custom fields.
Integrate the data from the form to the zoho books platform.
Basically, a user submit the form and on submission a new record on zoho books its created.
enter image description here
enter image description here
My issue, when the form is submitted theres no new customer on zoho books.
Can someone help me please
Thank You
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);
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("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);
contactP.put("is_primary_contact",true);
contactMap.put("billing_address",billingMap);
cpList.add(contactP);
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:"books"
];
This was the way i was able to make it work.
There might need to be an authentication token for 'books' included in the headers. Check the books.zoho API documentation to see if there is information regarding creating and using an API token.
Also by adding detailed:true to the invokeurl call you can get some visibility into any information or error-messages in the response from invokeurl. Here is some example code:
response = invokeurl
[
url : "https://books.zoho.eu/api/v3/contacts?orgainization_id=20077348839
type :POST
parameters:datamap
connection:"books_contact_auth"
detailed:true
];
// To see all headers and content
info response;
Related
relative to this answer: How to make follower-following system with django model
I will like to know how to get all the post of the user that I'm following just in case I'll want to add that extra functionality in the future.
You will have an another Model Post associated with User.
class Post(models.Model):
description = models.TextField()
user = models.ForeignKey("User", related_name="posts")
Getting all posts of following_user_id, you can achieve by below query
following_user_ids = request.user.followers.all().values_list("following_user_id", flat=True)
posts = Post.objects.filter(user__in=following_user_ids)
request.user is the logged-in user, related_name="followers" is used get all associated records from UserFollowing Model. values_list() will return the following_user_id in list form than pass the returned list in Post
I need to fetch Data from Zoho Books to Zoho Creator.
How to get Invoice, Estimate, Customer data?
How to fetch 200+ records?
Through single API call we will get only 200 records.
First we have to make a connection from Zoho Creator to Zoho Books ,
For that Go to Zoho Creator/ Setup/ Connection and Make a connection (Select Zoho books module only).
Now you have to go to Zoho Books and in settings you will find User and Roles, Assign user to that email in which you want to fetch the data. Make that email Role as Admin.
you need to accept the invitation from Zoho books.
For example here I am fetching Invoice module from Zoho Books to Zoho Creator.
void invoice()
{
organizationID = input org_id number;
invlist = List();
pageList = {1,2,3};
itemList = List();
customerList = List();
i = 0;
for each page in pageList
{
i = i + 1;
invoices = invokeurl
[
url :"https://books.zoho.in/api/v3/invoices?page=" + page + "&per_page=200&organization_id=" + organizationID
type :GET
connection:"zohobooks"
];
invoices = invoices.get("invoices");
info "invoices" + invoices;
for each findItems in invoices
{
info "findItems" + findItems;
invoiceID = findItems.get("invoice_number");
customerID = findItems.get("customer_name");
balanceID = findItems.get("balance");
dateID = findItems.get("date");
amountID = findItems.get("total");
itemID = findItems.get("line_items");
statusID = findItems.get("status");
// Invoice is form name, We are inserting data in that form
insert into Invoice
[
Added_User=zoho.loginuser
Invoice_Number=invoiceID
Customer_Name=customerID
Balance=balanceID
Date_field=dateID
Amount=amountID
Status=statusID
]
}
}
info invlist;
}
Please check related to Zoho License Subscription usage and restriction.
The link is
Zoho Help Link
If you have exhausted the usage limit take help from Zoho for increasing your usage limit as per your company requirement.
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:
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
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:"..." ];
The last 3 fields are File type and you must send them as attachements to your invokeurl.
response = zoho.inventory.getRecords("Item","i inserted ID in here");
var = response.get("Product Name");
for each hey in var
{
insert into SKU #SKU is a form in Zoho Creator
[
Added_User=zoho.loginuser
Item_Name=hey #Item_Name is my field in SKU
]
}
Above code not fetching the Product Name Data from Inventory into Zoho Creator
To serarch in Inventory you must use:
<response> = zoho.inventory.getRecords(<module>, <org_id>, [<criteria_map>], [<connection>]);
The module is Items. In "Settigs" -> "Profile organization" you can obtain your org_id. It returns a map and you have to iterate over response.get("Items")
I you want to get a single item and you have the ID you can use the next function
<response> = zoho.inventory.getRecordsByID(<module>, <org_id>, <record_id>, [<connection>]);
If you want to view the reponse, you can use "info response;" or "alert response;" depend where you are using it.
Are you sure, you are using the correct link name of 'Product Name' field, try 'Product_Name' instead.
Please Used the Correct API Name for fetch out in Map.
getRecords()- used to get all records (200) at time & for Individual records try this:getRecordsByID()
response = zoho.inventory.getRecords("Item","i inserted ID in here");
Org id is missing in this get record code.
var = response.get("Product Name");
make sure you are using a correct api name of the product name
I'm trying to display related users through the Google GData Contacts API.
URL feedUrl = new URL("https://www.google.com/m8/feeds/contacts/default/full");
Query q = new Query(feedUrl);
q.setMaxResults(max);
q.setUpdatedMin(q.getUpdatedMin());
ContactFeed feed = client.query(q, ContactFeed.class);
for(ContactEntry item : feed.getEntries()){
[...]
}
I know that there is a public image url for profiles on Google.
https://www.google.com/s2/photos/profile/{user_id}
https://plus.google.com/s2/photos/profile/{user_id}
https://profiles.google.com/s2/photos/profile/{user_id}
However, when I retrieve a user's contacts, there just doesn't seem to be a field available to reference that user_id.