Welcome to Portal

?Unknown\pull-down

Welcome to Zoho Cares

Bienvenido a Soporte de Zoho

Search our knowledge base, ask the community or submit a request.

What is the mechanism for adding subform data in the Creator v2 REST APIs?  There is nothing documented in the Data APIs documentation (https://www.zoho.com/creator/help/api/v2/).  

I was able to determine how to GET the subform data by adding it to the report and specifying the fields required along with a delimiter, which is wonky, but works (the data is in JSON - why not just add an element in the JSON for each of the subform fields instead of appending them all to one element?) 

However, I cannot find anything for how to add or update subform data for a form.  This had been done using the XML RPC APIs in v1, but that is going away as well, and does not support OAuth, so we need to migrate away from that as well.

Can we add the records directly to the subform?  But how will they be linked to the main form?  Can we add multiple records in one call, liek we can with XML RPC?  I don't want to have to make 3 REST calls to update one form and its 2 subforms.

1 user has this question.
11 Replies
Reply

To Add subform records use an array like so;
  1. {
  2.     "data": {
  3.         "Name": "Vinnie",
  4.         "Dropdown": "Test",
  5.         "SubForm" : [
  6.         {
  7.              "SF_Field_1" : "Num 1",
  8.              "SF_Field_2" : "Num 2",
  9.              "SF_Field_3" : "Num 3"
  10.         },
  11.         {
  12.              "SF_Field_1" : "Num 1",
  13.              "SF_Field_2" : "Num 2",
  14.              "SF_Field_3" : "Num 3"
  15.         }
  16.     ]
  17.    }
  18. }

To update subform records GET the parent record by criteria or by ID, and the response will contain the subform ID's

  • 2 months ago

I can add the subform data, but want to ask how can we update subform data, and I have update api which updates other fields data, but I want to update subform as well, when I am doing with update api, it is creating new record not updating. 

  • 4 years ago

Yep - that worked! Thanks!

Where did you find this info? I haven't seen this documented anywhere.

try here: https://www.zoho.com/creator/help/api/v2/add-records.html

Go to 'Sample input to add one record', click on 'Show full'

How did you manage to get the related record?
I'm getting something like this but I don't know what to do with that ID since it's not the related record Id.
"items": [
{
"display_value": "1",
"ID": "39258XXXXXXXXX11"
},....

  • 3 years ago

I am also facing the same issue. Is there a way to get the data or is it not possible to get the data? I tried the delimiter character like <url>/<reportID>/Item|ID but that did not work. I wanted to get a subform Item and get the actual data inside the subform.

  • 3 years ago

Hello,

You can get the data only based on main form fields and not from subform fields.

Good Day !

I am dealing with a similiar issue that is driving me nuts, i have worked on this for over 2 weeks.  I am trying to update a subform using the "zoho.creator.UpdateRecords" function.  The payload I am sending is below. I get a response back from Creator that the data was updated successfully but there is no update in my creator report.
 *Note* the body has been shortened for posting here.
  1. {
    "data": {
    "SendEmail": "Test",
    "Email_Chain": [
    {
    "Status": "Opened: 2022-06-21T18:34:30Z",
    "Inbound_Outbound": "outbound",
    "Subject_field": "last ditch",
    "Time": "21-Jun-2022 14:34:10",
    "ID": 3849855000023711000,
    "Recipient_Sender": "@gmail.com",
    "Tag": "msi35s@gmail.com_21-Jun-2022 14:33:56",
    "Body": "<div>efforts to make this work</div>"
    },
    {
    "Recipient_Sender": "Maurice Simpkins",
    "Sender_field": "msimpkins@amsa-consulting.com",
    "Status": "Responded",
    "Subject_field": "Re: last ditch",
    "Body": "<div dir=\"ltr\">c<br clear=\"all\">></div>\r\n",
    "Time": "06/26/22 07:49:59",
    "Inbound_Outbound": "inbound",
    "Tag": "msi35s@gmail.com_21-Jun-2022 14:33:56"
    }
    ]
    }
    }

 

Remove the "ID" field as it's not needed.

If "Time" is an actual time field it should be in the following format with no date: "14:33:56",
if it is a date-time field then try like so: "Jun-26-2022 07:49:59"

For testing purposes try updating just a single-line field in the subform first




  • 2 months ago

Hello Kajal,

Currently, the existing subform rows will be removed if we add or update the new rows via API. As a work around, we need to first fetch the subform's existing rows and then have to create a dynamic map to include the existing subform rows along with newly added subform row and then should pass by combining all. A sample for the same is given below.
  1. void APIUpdate(string DropD, string Singlee )
  2. {
  3. liss=List();
  4. getData = invokeUrl
  5.     [
  6.     url: "<getRecordsByID API URL>"
  7.     type: GET
  8.     connection: "creatorconnection"
  9.     ];
  10. getSubData=getData.get("data");
  11. for each rec in getSubData 
  12. {
  13. lis= rec.get("SubForm");
  14. for each rec1 in lis
  15. {
  16. map1=Map();
  17. getLis= rec1.get("display_value") ;
  18. map1.put("DropDown", getLis.getprefix(","));
  19. map1.put("Single_Line", getLis.getsuffix(","));
  20. map1.put("row_action", "add");
  21. liss.add(map1);
  22. mapp2=Map();
  23. mapp2.put("DropDown",input.DropD);
  24. mapp2.put("Single_Line", input.Singlee);
  25. mapp2.put("row_action", "add");
  26. liss.add(mapp2);
  27. map2=Map();
  28. map2.put("SubForm",liss);
  29. DataParam=Map();
  30.  DataParam.put("data", map2);
  31. inv = invokeUrl
  32.     [
  33.     url: "https://creator.zoho.in/api/v2/AppOwnerName/AppName/report/ReportName/16113000001529007"
  34.     type: PATCH
  35.     parameters: DataParam.toString()
  36.     connection: "creatorconnection"
  37.     ];
  38. }

The above case is a reference to add/update a drop down and a single line field inside a subform. You can refer this and can try on the same.

Good Day !

  • 11 days ago

You can use the method of the previous message of Sriram U but make optimisation by using in place of her code between lines 15 and 23 :

  1. for each rec1 in lis
  2. {
  3. map1=Map();
  4. map1.put("ID", rec1.get("ID"));
  5. map1.put("row_action", "update");
  6. liss.add(map1);
  7. }



Reply to Mike RyanA
/* */
  • 12
  • Insert
  • Plain text
Add Comment
(Up to 20 MB )