Create Contract API Endpoint Unclear "inputfields" Requirements

Create Contract API Endpoint Unclear "inputfields" Requirements

Hello,

I'm trying to create a Deluge function that accepts inputs from a form in Zoho Creator and creates a barebones contract of a given type. See below for the current code, cleaned of authentication information.
  1. // Fetch form data
  2. // Hidden field
  3. client_name = input.Client_Name;
  4. if(client_name == null || client_name == "")
  5. {
  6. client_name = "Testing Client";
  7. }
  8. // Dropdown field
  9. contract_type = input.Contract_Type;
  10. // Single line field
  11. title = input.Title;
  12. // Multi-line field
  13. description = input.Description;
  14. // Dropdown field
  15. signer_name = input.Signer_Name;
  16. //
  17. // Define the access token and refresh token
  18. accessToken = "ACCESS_TOKEN";
  19. refreshToken = "REFRESH_TOKEN";
  20. //
  21. // Define headers for token refresh request
  22. tokenRefreshHeaders = Map();
  23. tokenRefreshHeaders.put("Content-Type","application/x-www-form-urlencoded");
  24. tokenRefreshParameters = Map();
  25. tokenRefreshParameters.put("grant_type","refresh_token");
  26. tokenRefreshParameters.put("client_id","CLIENT_ID");
  27. tokenRefreshParameters.put("client_secret","CLIENT_SECRET");
  28. tokenRefreshParameters.put("refresh_token",refreshToken);
  29. //
  30. // Refresh the access token
  31. response = invokeurl
  32. [
  33. url :"https://accounts.zoho.com/oauth/v2/token"
  34. type :POST
  35. parameters:tokenRefreshParameters
  36. headers:tokenRefreshHeaders
  37. ];
  38. if(response.get("access_token") != null)
  39. {
  40. accessToken = response.get("access_token");
  41. }
  42. //
  43. // Define headers for Zoho Contracts API request
  44. contractsHeaders = Map();
  45. contractsHeaders.put("Authorization","Zoho-oauthtoken " + accessToken);
  46. contractsHeaders.put("Content-Type","application/json");
  47. //
  48. // Prepare contract data
  49. contract_type = lower(replaceAll(contract_type," ","-"));
  50. client_name = lower(replaceAll(client_name," ","-"));
  51. signerNameContainsTitle = signer_name.containsIgnoreCase(". ");
  52. signerFirstSpace = signer_name.find(" ");
  53. if(signerNameContainsTitle)
  54. {
  55. signerTitle = signer_name.left(signerFirstSpace);
  56. signerFullName = signer_name.remove(signerTitle).trim();
  57. signerFirstSpace = signerFullName.find(" ");
  58. signerFirstName = signerFullName.left(signerFirstSpace);
  59. signerLastName = signerFullName.remove(signerFirstName).trim();
  60. }
  61. else
  62. {
  63. signerFirstName = signer_name.left(signerFirstSpace);
  64. signerLastName = signer_name.remove(signerFirstName).trim();
  65. }
  66. signer_record = zoho.crm.searchRecords("Contacts","(First_Name:equals:" + signerFirstName + ") and (Last_Name:equals:" + signerLastName + ")");
  67. signer_email = signer_record.get(0).get("Email");
  68. //
  69. // Create nested maps/lists in the structure of the contracts API JSON
  70. contractDataMap = Map();
  71. contractDataMap.put("source",1);
  72. inputFieldsList = List();
  73. contractTypeInputFieldMap = Map();
  74. contractTypeInputFieldMap.put("metaApiName","contract-type");
  75. contractTypeInputsList = List();
  76. contractTypeInput = Map();
  77. contractTypeInput.put("inputApiName","contract-type");
  78. contractTypeInput.put("inputValue","non-disclosure-agreement");
  79. contractTypeInputsList.add(contractTypeInput);
  80. contractTypeInputFieldMap.put("inputs",contractTypeInputsList);
  81. inputFieldsList.add(contractTypeInputFieldMap);
  82. titleInputFieldMap = Map();
  83. titleInputFieldMap.put("metaApiName","title");
  84. titleInputsList = List();
  85. titleInput = Map();
  86. titleInput.put("inputApiName","title");
  87. titleInput.put("inputValue",title);
  88. titleInputsList.add(titleInput);
  89. titleInputFieldMap.put("inputs",titleInputsList);
  90. inputFieldsList.add(titleInputFieldMap);
  91. descriptionInputFieldMap = Map();
  92. descriptionInputFieldMap.put("metaApiName","description");
  93. descriptionInputsList = List();
  94. descriptionInput = Map();
  95. descriptionInput.put("inputApiName","description");
  96. descriptionInput.put("inputValue",description);
  97. descriptionInputsList.add(descriptionInput);
  98. descriptionInputFieldMap.put("inputs",descriptionInputsList);
  99. inputFieldsList.add(descriptionInputFieldMap);
  100. requesterNameInputFieldMap = Map();
  101. requesterNameInputFieldMap.put("metaApiName","requester-name");
  102. requesterNameInputsList = List();
  103. requesterNameInput = Map();
  104. requesterNameInput.put("inputApiName","requester-name");
  105. requesterNameInput.put("inputValue","Tom Rismeyer");
  106. requesterNameInputsList.add(requesterNameInput);
  107. requesterNameInputFieldMap.put("inputs",requesterNameInputsList);
  108. inputFieldsList.add(requesterNameInputFieldMap);
  109. requesterDepartmentInputFieldMap = Map();
  110. requesterDepartmentInputFieldMap.put("metaApiName","requester-department");
  111. requesterDepartmentInputsList = List();
  112. requesterDepartmentInput = Map();
  113. requesterDepartmentInput.put("inputApiName","requester-department");
  114. requesterDepartmentInput.put("inputValue","sales");
  115. requesterDepartmentInputsList.add(requesterDepartmentInput);
  116. requesterDepartmentInputFieldMap.put("inputs",requesterDepartmentInputsList);
  117. inputFieldsList.add(requesterDepartmentInputFieldMap);
  118. partyBNameInputFieldMap = Map();
  119. partyBNameInputFieldMap.put("metaApiName","party-b-name");
  120. partyBNameInputsList = List();
  121. partyBNameInput = Map();
  122. partyBNameInput.put("inputApiName","party-b-name");
  123. partyBNameInput.put("inputValue","guy-mcnobody);
  124. partyBNameInputsList.add(partyBNameInput);
  125. partyBNameInputFieldMap.put("inputs",partyBNameInputsList);
  126. inputFieldsList.add(partyBNameInputFieldMap);
  127. counterpartyPrimaryContactInputFieldMap = Map();
  128. counterpartyPrimaryContactInputFieldMap.put("metaApiName","counterparty-primary-contact");
  129. counterpartyPrimaryContactInputsList = List();
  130. counterpartyPrimaryContactInput = Map();
  131. counterpartyPrimaryContactInput.put("inputApiName","party-b-primary-contact-name");
  132. counterpartyPrimaryContactInput.put("inputValue",signer_email);
  133. counterpartyPrimaryContactInputsList.add(counterpartyPrimaryContactInput);
  134. counterpartyPrimaryContactInputFieldMap.put("inputs",counterpartyPrimaryContactInputsList);
  135. inputFieldsList.add(counterpartyPrimaryContactInputFieldMap);
  136. contractTermInputFieldMap = Map();
  137. contractTermInputFieldMap.put("metaApiName","contract-term");
  138. contractTermInputsList = List();
  139. contractTermInput = Map();
  140. contractTermInput.put("inputApiName","contract-term");
  141. contractTermInput.put("inputValue",false);
  142. contractTermInputsList.add(contractTermInput);
  143. contractTermInputFieldMap.put("inputs",contractTermInputsList);
  144. inputFieldsList.add(contractTermInputFieldMap);
  145. contractEffectiveDateInputFieldMap = Map();
  146. contractEffectiveDateInputFieldMap.put("metaApiName","contract-effective-date");
  147. contractEffectiveDateInputsList = List();
  148. contractEffectiveDateInput = Map();
  149. contractEffectiveDateInput.put("inputApiName","contract-effective-date");
  150. contractEffectiveDateInput.put("inputValue",1);
  151. contractEffectiveDateInputsList.add(contractEffectiveDateInput);
  152. contractEffectiveDateInputFieldMap.put("inputs",contractEffectiveDateInputsList);
  153. inputFieldsList.add(contractEffectiveDateInputFieldMap);
  154. renewalTypeInputFieldMap = Map();
  155. renewalTypeInputFieldMap.put("metaApiName","renewal-type");
  156. renewalTypeInputsList = List();
  157. renewalTypeInput = Map();
  158. renewalTypeInput.put("inputApiName","renewal-type");
  159. renewalTypeInput.put("inputValue",1);
  160. renewalTypeInputsList.add(renewalTypeInput);
  161. renewalTypeInputFieldMap.put("inputs",renewalTypeInputsList);
  162. inputFieldsList.add(renewalTypeInputFieldMap);
  163. contractDataMap.put("inputfields",inputFieldsList);
  164. //
  165. // Create the contract in Zoho Contracts
  166. response = invokeurl
  167. [
  168. url :"https://contracts.zoho.com/api/v1/contracts"
  169. type :POST
  170. parameters:contractDataMap
  171. headers:contractsHeaders
  172. ];
  173. if(response.get("code") == 201)
  174. {
  175. alert "Contract created successfully";
  176. }
  177. else
  178. {
  179. alert "Error in creating contract: " + response.toString();
  180. cancel submit;
  181. }

Here is the resulting JSON per logging:
  1. {
  2.   "source": 1,
  3.   "inputfields": [
  4.     {
  5.       "metaApiName": "contract-type",
  6.       "inputs": [
  7.         {
  8.           "inputApiName": "contract-type",
  9.           "inputValue": "non-disclosure-agreement"
  10.         }
  11.       ]
  12.     },
  13.     {
  14.       "metaApiName": "title",
  15.       "inputs": [
  16.         {
  17.           "inputApiName": "title",
  18.           "inputValue": "Test title"
  19.         }
  20.       ]
  21.     },
  22.     {
  23.       "metaApiName": "description",
  24.       "inputs": [
  25.         {
  26.           "inputApiName": "description",
  27.           "inputValue": ""
  28.         }
  29.       ]
  30.     },
  31.     {
  32.       "metaApiName": "requester-name",
  33.       "inputs": [
  34.         {
  35.           "inputApiName": "requester-name",
  36.           "inputValue": "Tom Rismeyer"
  37.         }
  38.       ]
  39.     },
  40.     {
  41.       "metaApiName": "requester-department",
  42.       "inputs": [
  43.         {
  44.           "inputApiName": "requester-department",
  45.           "inputValue": "sales"
  46.         }
  47.       ]
  48.     },
  49.     {
  50.       "metaApiName": "party-b-name",
  51.       "inputs": [
  52.         {
  53.           "inputApiName": "party-b-name",
  54.           "inputValue": "guy-mcnobody"
  55.         }
  56.       ]
  57.     },
  58.     {
  59.       "metaApiName": "counterparty-primary-contact",
  60.       "inputs": [
  61.         {
  62.           "inputApiName": "party-b-primary-contact-name",
  63.           "inputValue": "contact@mail.com"
  64.         }
  65.       ]
  66.     },
  67.     {
  68.       "metaApiName": "contract-term",
  69.       "inputs": [
  70.         {
  71.           "inputApiName": "contract-term",
  72.           "inputValue": false
  73.         }
  74.       ]
  75.     },
  76.     {
  77.       "metaApiName": "contract-effective-date",
  78.       "inputs": [
  79.         {
  80.           "inputApiName": "contract-effective-date",
  81.           "inputValue": 1
  82.         }
  83.       ]
  84.     },
  85.     {
  86.       "metaApiName": "renewal-type",
  87.       "inputs": [
  88.         {
  89.           "inputApiName": "renewal-type",
  90.           "inputValue": 1
  91.         }
  92.       ]
  93.     }
  94.   ]
  95. }

I'm getting this error when I submit the form, triggering the deluge function:
  1. Error in creating contract: {"Errors":{"ErrorCode":"ZSEC-JSON_PARSE_ERROR","ErrorMessage":"Sorry, unable to complete your action due to an unknown error. Please try again.","APIErrorMessage":"JSON_PARSE_ERROR"}}

The error message is not very helpful, as it does not specify where it has an issue when parsing the JSON. The API documentation does not specify which fields are required for the Create Contract Endpoint, so I'm either left posting here to request more info, or to just tinker with different combinations of fields included and excluded, so I'm posting here. Can anybody help determine exactly which fields I'm missing, using incorrectly, or other issues with the JSON?
    • Recent Topics

    • Automate pushing Zoho CRM backups into Zoho WorkDrive

      Through our Zoho One subscription we have both Zoho CRM and Zoho WorkDrive. We have regular backups setup in Zoho CRM. Once the backup is created, we are notified. Since we want to keep these backups for more than 7 days, we manually download them. They
    • Question about retrieving unsubscribed contacts (outside of lists) via API

      Hello, I am currently using Zoho Marketing Automation and would like to integrate it with our company’s core system. For this purpose, I am exploring the API options available to retrieve contact information. Specifically, I would like to know if there
    • Getting “mandatory field missing: Service_Line_Items” When Creating Work Order via Zoho Flow Deluge

      Hi Team, I’m trying to create a Work Order in Zoho FSM with only a Service Line Item (no Parts). However, I keep getting this error: Work Order Response: {"code":"MANDATORY_NOT_FOUND","details":{"api_name":"Service_Line_Items"},"message":"required field
    • How to customize the colors of the Client Portal login screen and add the company logo?

      As title, how to customize the colors of the Client Portal login screen and add the company logo?
    • Daily updates/fixes and how to see what was changed?

      When I receive the notification that zoho was updated and I need to refresh it. How can I see what was changed or fixed? Sometimes they change things that effect my books and I need to know what they did. For example over this past weekend something was
    • Upcoming Change: Snowflake Username/Password Authentication Deprecation – Action Required

      Hello Users, Snowflake has officially announced that username and password-based authentication will be deprecated by November 2025. You can find the official announcement [here]. If you're using a Snowflake connection in Zoho Analytics to import data,
    • Why should I choose Zoho Inventory vs Odoo?

      Hello there! I have used Zoho in different companies I've worked in, and I have a positive perception of it. I am starting a new import business for pipes, tubes, fittings, valves, elbows, etc., which all have serial numbers, cast numbers, etc., so I
    • Product Updates in Zoho Workplace applications | July 2025

      Hello Workplace Community, Let’s take a look at the new features and enhancements that went live across all Workplace applications this July. Zoho Mail Import bookmarks from Pocket Worried about losing your Pocket bookmarks? Don't worry we have got you.
    • PLEASE FIX YOR BUGS

      PICTURES ARE BEING REJECTED DESPITE THEM FOLLOWING THE GUIDELINES ON DIMENTIONS.
    • Kaizen# 204 - Answering Your Questions | Perform Field Updates before Blueprint transition via Client Script

      Hello everyone! Welcome back to another exciting Kaizen post. One of the questions we received through your Kaizen feedback was: “How can I update fields before Blueprint transition and how to prevent a transition based on a condition using Client Script?”
    • Create online meetings for Booking Pages with Zoho Meetings and Zoom

      Greetings, We hope you're all doing well. We're excited to share some recent enhancements to Bigin's Booking Pages. As you know, Booking Pages let you create public pages to share your availability so that your customers can easily book time slots with
    • Filters in audit logs

      Greetings, I hope all of you are doing well. We're happy to announce a few recent enhancements we've made to Bigin. We'll go over each one in detail. Previously, there were no filters available to narrow down data in audit logs. Now, we've introduced
    • Enhanced help options in Bigin

      Greetings, We're excited to introduce a new enhancement to Bigin's Help section: a comprehensive Help Options panel that brings together all your support resources in a single, well-organized space. Previously, the Need Help? menu provided only a limited
    • Zoho FSM API Developer Needed

      Hi, I’m looking for a developer with experience using Zoho FSM APIs. Scope: Connect WordPress website booking form to Zoho FSM Check availability (date, time, region) Create Work Orders + Service Appointments automatically Notify both customer and scheduler
    • Revenue Management: #4 What if there are uncertainties in project or service delivery?

      Our previous post taught us how Zoho Billing makes life easy for businesses with its automated revenue recognition rule. However, certain businesses have more challenges that an automated system cannot handle, and there are certain situations where automated
    • This mobile number has been marked spam. Please contact support-as@zohocorp.com

      Bom dia, estou tentando colocar o número 11 94287-6695 e esta com erro "This mobile number has been marked spam. Please contact support-as@zohocorp.com" pode me ajudar, por favor?
    • Items Serial Tracking Issue

      We enabled Zoho Items inventory tracking then disabled it after some time now we want to enable it again When I check the missing serial number reports I see one item But I cant see any option to Add the serial numbers Where and how to add the serial
    • Zoho Payroll integration with Zoho Books - unable to match multiple bank feeds to one wage payment

      For one employee's wage, I make two partial payments. Those bank feed transactions come into Zoho Books via bank integration. I make one pay-run for the month in Zoho Payroll and that comes into Zoho Books via the Zoho integration. Zoho Books doesn't let me match multiple bank feed transactions against a single wage item. Please fix urgently. I can't complete my books because of this.
    • Add Checkbox Selection & Bulk Actions to Delivery Challans Module

      Hi Zoho Team, I’ve noticed that in the Sales Orders module, there are checkboxes beside each entry that allow users to select multiple records for bulk actions such as print, email, or delete. However, in the Delivery Challans module, this option appears
    • Can't be able to check-in in laptop

      even after giving location access still i can't be able to check-in in laptop.
    • Compensation Cess on Coal ₹400 per tonne. ?????

      The compensation cess rate varies by the type of product. And the cess is calculated based on the value of the product without GST. Coal, for example, comes with a cess of ₹400 per tonne. That means that if you sell 2 tonnes of coal that have a value
    • 7 month over zoho book purchase but still not immpliments Golive

      7 month over zoho book purchase but still not immpliments Golive one problems zoho team short out then other problems come still very poor mangments and immliments team . struggling with the templates in ZOHO Books. Especially with the placement of some
    • SMS to customers from within Bigin

      Hi All, Is there anyone else crying out for Bigin SMS capability to send an SMS to customers directly from the Bigin interface? We have inbuilt telephony already with call recordings which works well. What's lacking is the ability to send and receive
    • Parent & Member Accounts (batch updating / inheritance)

      Hello, I find the Parent Account functionality very useful for creating custom views and reports, but was wondering if I can also carry out batch editing on all members (aka children) of a Parent Account at the same time. Alternatively, can I set members to automatically inherit the values of the parent? For example: We have a chain of supermarkets that buy our products. These supermarkets are all members of a Parent Account in our CRM. We release a new product and all of the member stores wish to
    • Edit Legend of Chart

      I would like to edit the legend of the chart. Every time I enable the legend, I get a very unhelpful (1), and when I try to type to change to what I would desire, nothing happens, which is very frustrating. I've gone through your online tutorials and nowhere can I find a legend settings button. This seems a simple fix, where can edit the legend? Thanks.
    • Extended timeouts for APIs beyond 40secs for to accomodate LLMs

      A 40 second max response time for API calls is fine when connecting to most services, however is unsuitable when dealing with LLMs (ChatGPT/Claude/Gemini) where the response timing is very uncertain. Is there any way to increase this? It would be great
    • Deletion of Zoho Account

      To whom it may concern, Good day, My account has been created incorrectly in Zoho and I am not able to join my Company's Zoho account - attached screenshot for your kind reference Alphatronmarine - Portal Kindly advise procedure to delete this current
    • Workflow for deposit to bank account

      Hello, Is it possible to make a workflow when a deposit is made to your bank account which is coupled to Zoho books? I want Zoho to sent an email each time a deposit is made to our bank account via a workflow. Regards, Steven
    • Marking Retainer invoice paid through Deluge

      Hey Everyone, We have a scenario where we are collecting deposit payments on our website. Now, in zoho books, we need to create a retainer invoice and mark it as paid automatically using deluge just like we can mark normal invoices as paid. I have tried
    • Create a new record in custom module vi custom button

      I have zoho books premium plan . I have 2 custom modules in zoho books. 1. Goods Receipt 2. Delivery Order, I need to select multiple records from Goods Receipt and create a new Delivery order from these multiple records. (like multilple sales order into
    • Profile date settings

      At present I have "EEE, MMMM dd, yyyy" but this takes an exessive amount of column space, we should be able to input our own format. I would like to use "EEE, MMM dd, yy" - a much shorter version of the above but with the same abbreviated info, requiring
    • Delivery Method Field in Sales Order Module

      In Books and in Sales orders, the "Delivery Method" field seems to allow for anything to be entered and it seems to store those entries for future use.  When you chose to convert a sales order to a purchase order, the related field is now called "Shipment
    • Editing / Removing stages for pipeline

      Hello, I'm trying to create a new pipeline. I created a new stage and made an error when entering the probability. How can I edit fields in stages that I created? Can I delete these stages from "Add Stages" list?
    • Dynamically Filter User Lookup in CRM Subform

      We have a subform called Pricing Calculator in the Zoho CRM Opportunity module and need some assistance. Current Setup: First column: Picklist (Level) Second column: User Lookup field When a Level is selected, we want the User lookup to display only users
    • change time zone

      can't seem to figure out how to change the time zone of the project
    • Bigin iOS app update: Built-in telephony and RingCentral support

      Hello everyone! We are excited to introduce Built-In Telephony and RingCentral support in the latest iOS version(v1.11.13) of the Bigin mobile app. Once the integration is completed on the Bigin desktop site(bigin.zoho.com), you can choose the Built-In
    • Add Image or Update Image API - for Items Module

      I am trying to add new Items to Zoho Inventory from Zoho Creator. I achieved this using Zoho Inventory Create Item API, but how to add or update the item image from Zoho Creator to Zoho Inventory Item Module?
    • Introducing Booking Pages—a topping for your Calendar Scheduling needs!

      Greetings, We're here with a new topping for Bigin! Let's dive into the details. What does this topping do? Scheduling appointments with customers is one of the most common challenges small businesses face on a daily basis, as it often involves frequent
    • Debugging `try` blocks : Tip

      I find it annoying that if one line inside a `try` block has an error, the Deluge arser points the beginning of the block to the location of the error. BUT, if you temporarily comment out the initial `try {`  The parser goes through the whole block and
    • Use approval workflow comments in record scripts

      Greetings, i'm running an approval workflow for my records, during approval/rejection there is a step where comments are entered. i want to add there comments to the record and to use them in various deluge scripts like sending emails and so on.  how
    • Next Page