Hi
I bring here two problems with the data obtained by GetRecordsByID methods, first by API call, second by deluge task
1. Calling Zoho CRM API with GetRecordsByID API method:
I am trying to process Zoho CRM Get records by ID API method JSON response.
i call this URL :
the call is performed from a Zoho Creator application by using the postUrl deluge task as follows:
Here is the response i get:
response={"response":{"result":{"Quotes":{"row":{"no":"1","FL":[{"content":"1076657000000912019","val":"QUOTEID"},{"content":"111111","val":"Quote Number"},{"content":"TalTestQuote","val":"Subject"},{"content":"Draft","val":"Quote Stage"},{"content":"111111","val":"CONTACTID"},{"content":"test contact first name test contact Last name","val":"Contact Name"},{"content":"111111","val":"ACCOUNTID"},{"content":"test account","val":"Account Name"},{"content":"111111","val":"SMOWNERID"},{"content":"OWNER","val":"Quote Owner"},{"content":"111111","val":"SMCREATORID"},{"content":"OWNER","val":"Created By"},{"content":"111111","val":"MODIFIEDBY"},{"content":"OWNER","val":"Modified By"},{"content":"2015-03-30 21:03:27","val":"Created Time"},{"content":"2015-03-30 21:03:27","val":"Modified Time"},{"content":"200","val":"Sub Total"},{"content":"0","val":"Tax"},{"content":"0","val":"Adjustment"},{"content":"200","val":"Grand Total"},{"product":[{"no":"1","FL":[{"content":"111111","val":"Product Id"},{"content":"Test Product 1","val":"Product Name"},{"content":"100.0","val":"Unit Price"},{"content":"1.0","val":"Quantity"},{"content":"0.0","val":"Quantity in Stock"},{"content":"100.0","val":"Total"},{"content":"0.0","val":"Discount"},{"content":"100.0","val":"Total After Discount"},{"content":"100.0","val":"List Price"},{"content":"100.0","val":"Net Total"},{"content":"0.0","val":"Tax"}]},{"no":"2","FL":[{"content":"111111","val":"Product Id"},{"content":"Test Product 2","val":"Product Name"},{"content":"100.0","val":"Unit Price"},{"content":"1.0","val":"Quantity"},{"content":"0.0","val":"Quantity in Stock"},{"content":"100.0","val":"Total"},{"content":"0.0","val":"Discount"},{"content":"100.0","val":"Total After Discount"},{"content":"100.0","val":"List Price"},{"content":"100.0","val":"Net Total"},{"content":"0.0","val":"Tax"}]}],"val":"Product Details"},{"content":"Test T&C","val":"Terms and Conditions"},{"content":"0","val":"Discount"},{"content":"ILS","val":"Currency"},{"content":"1.000000000","val":"Exchange Rate"},{"content":"כלום","val":"Demo"},{"content":"false","val":"Send Doc By Email"},{"content":"true","val":"Vat Included"},{"content":"he","val":"Doc Language"}]}}},"uri":"/crm/private/json/Quotes/getRecordById"}}
I need to get to the data stored in this response in a way that allows me iteration and automation
so, the purpose is to get to the data stored in JSON pair values, turn it to JSON List, and iterate it.
but with invetory modules there is a problem.
I try to extract the data as follows:
- resp = postUrl(url, sendmap,false);
- responseText = (resp.get("responseText")).toMap();
- response = (responseText.get("response")).toMap();
- result = (response.get("result")).toMap();
- Quotes = (result.get("Quotes")).toMap();
- row = ModuleName.get("row");
- FL = row.get("FL");
I always get null for the last part (Extracting FL) which is the part that contains the JSON pair values of the data i need to process.
and what i get is null
i think that this is because each of the products is stored under "FL" and therfore there are multiple values for the same key.
I need a solution for this problem because i cannot hardcode the extraction of each piece of data. i want to do it on an automated iteration task.
Any ideas?
Zoho CRM team, i belive there is a format change to be made here, as the data is sent in a problematic way.
Why not send it the same way the GetRecordsById deluge task returns the JSON formated data?
i.e.:
response={"Quote Owner":"OWNER","Account Name":"test account","Quote Number":"1111111","Created By":"OWNER","MODIFIEDBY":"1111111","Doc Language":"he","Quote Stage":"Draft","SMOWNERID":"111111","Discount":"0","SMCREATORID":"111111","Send Doc By Email":"false","Adjustment":"0","Currency":"ILS","Terms and Conditions":"TestT&C","Vat Included":"true","Exchange Rate":"1.000000000","Subject":"TalTestQuote","QUOTEID":"111111","Demo":"כלום","Contact Name":"test contact first name test contact Last name","Tax":"0","ACCOUNTID":"111111","Grand Total":"200","product":"[{Product Name=Test Product 1, Quantity=1.0, List Price=100.0, Unit Price=100.0, Total After Discount=100.0, Quantity in Stock=0.0, Tax=0.0, Net Total=100.0, Discount=0.0, Product Id=111111, Total=100.0}, {Product Name=Test Product 2, Quantity=1.0, List Price=100.0, Unit Price=100.0, Total After Discount=100.0, Quantity in Stock=0.0, Tax=0.0, Net Total=100.0, Discount=0.0, Product Id=111111, Total=100.0}]","CONTACTID":"111111","Created Time":"2015-03-31 00:03:27","Modified By":"OWNER","Sub Total":"200","Modified Time":"2015-03-31 00:03:27"}
2.Problem with the data send back by GetRecordsByID deluge task:
in the above answer you can see that the internal JSON of product is not formatted as a valid JSON
instead of having ":" separatore, it has been switched with and equal sign "="
when i pass this data to a Zoho Creator function via API Call, i cannot procecss the internal map by a simple:
- Products_Array=response.get("product");
- ProductsJSONLIST=Products_Array.toJSONList;
it does not work because the internal data is not a valid JSON.
Why is it this way?
Thank you in advance.
Tal