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

      • Deleting Fields in CRM Deletes Views in Analytics

        Hey friends! I'm having some issues when we modify some fields within ZohoCRM. There are times where we need to sunset a field and eventually completely remove it. In these instances, it seems like a lot of views are removed in Analytics. This ranges
      • Zoho Analytics Automatically Deletes Queries and Reports When a Synced CRM Field Is Removed

        We’ve encountered a serious and recurring issue that poses a massive data integrity risk for any Zoho Analytics customer using Zoho CRM integration. When a field is deleted in Zoho CRM — even an unused one — Zoho Analytics automatically deletes every
      • How to setup pricing in Zoho

        Hi everyone, I am relatively new here and have just moved from my old inventory system to the Zoho one. I am trying to get my head around how it all works. I am mostly setup connected to a shopify store, but I do manual sales also For manual invoicing,
      • Prefilled Date fields auto-changed and then locked when using “Edit as new”

        If a document out for signature has date fields (not SignedDate fields) that were pre-filled before sending, and then you use “Edit as new” to create a new version of the same document, the value of those date fields gets automatically changed to today
      • Is there a way to update all the start and end dates of tasks of a project after a calendar change?

        Hi! Here's my situation. I've built a complete project planning. All its tasks have start dates and due dates. After completing the planning, I've realized that the project calendar was not the right one. So I changed the project calendar. I now have
      • Access Phone Field Components (Country Code) Directly

        Hello everyone, I'd like to propose an enhancement for the Phone field in Zoho Creator. The Problem: The Phone field captures the country code and local number separately, but stores them as a single string (e.g., +1234567890). To get the country code,
      • Send mass messages through WhatsApp from the Tickets module

        Hi Everyone! Effective communication is key to delivering prompt and reliable customer support. Because WhatsApp is one of the most widely used and familiar messaging platforms, it's an effective channel for agents to reach customers who have submitted
      • Lead Owner Signature Merge Field

        I want to automatically insert a signature (i.e. contact info usually found at the bottom of an email) into an email template, depending on who the lead owner is. What is the merge code for the Signature from a Users profile? CRM > Settings > Customization > Templates There is a popup near the bottom of the edit screen which says: "You can insert a Signature, which is available as a merge field in the users section." It is also referenced on this page: https://help.zoho.com/portal/en/kb/crm/customize-crm-account/customizing-templates/articles/template-builder#Merge_Fields
      • How do I create a time field?

        I want a field that only records time. I can only see how to create a date-time field. If I do that and enter a time, without a date, nothing is recorded. If I create a number or decimal field, I cannot use it in time calculations. All I want is a field
      • Experience effortless record management in CRM For Everyone with the all-new Grid View!

        Hello Everyone, Hope you are well! As part of our ongoing series of feature announcements for Zoho CRM For Everyone, we’re excited to bring you another type of module view : Grid View. In addition to Kanban view, List view, Canvas view, Chart view and
      • Alternating columns - How to reverse order on mobile - Responsive template

        Can the order of alternating columns be reversed on mobile so that image comes before the text? Example: Desktop Row 1 column Left (image) , column right (text) Row 2 column Left (text) , column right (image) Mobile Currently Row 1 Image over text Row
      • Let us view and export the full price books data from CRM

        I quote out of CRM, some of my clients have specialised pricing for specific products - therefore we use Price Books to manage these special prices. I can only see the breakdown of the products listed in the price book and the specialised pricing for
      • InvokeURL butchering JSON for OpenAI API calls

        My organization works with mostly educational institutions. We have a custom module called "Schools", which is the user-entered school name they put when using our service (which they enter along with their state and zip code). We want to map this to
      • CRM for email in Outlook: how to ignore addresses?

        We’re using the "Zoho CRM for email" add-in for Outlook. When opening an email, the add-in displays all email addresses from the message and allows me to add them to the CRM or shows if they’re already contacts. However, sometimes people listed in To
      • Custom order for Current Stage (Blueprint field)

        Hi! I suggest adding the option to set a custom order in reports for the Blueprint field ‘Current Stage’. Currently, these fields can only be sorted in ascending or descending order. Thanks!
      • CRM E-mail Sync from Outlook

        We are exploring Zoho as a possible new solution for our company. We are trying to understand further on how e-mail sync works. We use outlook. Our current CRM logs anytime we e-mail a customer so we can see in the CRM the message sent to the customer.
      • Run your help desk on your schedule

        In business, time is of the essence. This is especially true in a function like customer service, where KPIs such as response time and agent availability are the measures of success. Perhaps the most crucial consideration one needs to make about time is your hours of operation. These set expectations for your customer and for employees. To make communicating this information easier, we've revamped the way business hours and holiday lists work in Zoho Desk.   In order to accommodate teams that work
      • The Customer Happiness REST API is broken

        1. We are unable to extract the customerHappiness ( https://desk.zoho.com/DeskAPIDocument#CustomerHappiness#CustomerHappiness_ListallcustomerHappiness) object using the ticketNumber criteria. We keep getting HTTP 429 even when we limit to 60 calls per
      • Can the Product Image on the Quote Template be enlarged

        Hello, I am editing the Quote Template and added ${Products.Product Image} to the line item and the image comes up but it is very tiny. Is there anyway that you can resize this to be larger? Any help would be great! Thanks
      • Automatic Department and Employee Sync Between Zoho One and Zoho People

        Dear Zoho Support, I'm writing to propose a valuable feature request that would streamline data management and improve user experience within the Zoho ecosystem: automatic synchronization between departments and employees in Zoho One and Zoho People.
      • Zoho Expense and Chase Bank Visa credit cards - Direct Feed?

        Our company uses JP Morgan Chase Visa credit cards. We can't be the first to try and use a combination of Zoho Expense + Chase Bank + Visa Credit Cards --- anyone successful with this combination? 1. The direct feed automation isn't working. When I go
      • Impossibile inviare il messaggio;Motivo:554 5.1.8 Indirizzo del mittente bloccato

        " Impossibile inviare il messaggio;Motivo:554 5.1.8 Indirizzo del mittente bloccato" Hi need to send email, how can fix this? Thanks, Alice
      • Image inputed in Zoho Form were displayed to small in exported version

        Good evening, my name is athallah, i am a trainee in government office Right now, i use Zoho form to digitalize an airfield monitoring form. my problem is, the image were to small to displayed in exported version. it really bad for formal presentation
      • API. How do I get responses submitted to the form?

        Hi, I'm trying to retrieve a list of form responses via the API. I've created a Self Client application in API Console. What scoup should I enter? What are the endpoints? Is there documentation on this anywhere? I've wasted a lot of time searching. GPT
      • Question about Zoho CRM Professional plan users

        Hello! I have a question about the Zoho CRM Professional plan. Is the pricing charged per user or per organization? Are there any free users included in this plan, or do I need to pay for each additional user separately? Thank you!
      • Communicating with emojis

        On July 17, we celebrate World Emoji Day! We're a bit late 😐 sharing insights about this day. But we just couldn't let it pass without a mention 😊 because emojis have a meaningful connection with customer service 💬 🤝. We do not want to miss out on
      • Changing the Default Search Criteria for Finding Duplicates

        Hey everyone, is it possible to adjust the default search criteria for finding and merging duplicate records? Right now, CRM uses some (in my opinion nonsensical) fields as search criteria for duplicate records which do nothing except dilute the results.
      • Is it possible to create a word cloud chart in ZoHo Analystics?

        Hi there, I have a volume of transaction text that I would like to analyse using word cloud (or other approcah to detect and present word frequency in a dataset). For example, I have 50,000 records describing menu items in restaurants. I want to be able
      • Help integrating Aircall into Zoho CRM

        Hi all, We are need to get better AirCall integration into Zoho. We have configured in the Aircall dashboard but we have not done the Zoho side. We cannot see Zoho CRM information on incoming calls. And we calls and text's are not being logged. Specifically
      • Shopify Extension no longer working in CRM

        Zoho CRM and Extension are no longer working properly. We have used Shopify Basic for years. All of the sudden it stopped working, then started working again, and now no longer working again. There are several ways for Personal Information to sync from
      • How to keep track of bags, cans, drums of inventory?

        We buy and sell products that are packaged in bags 🛍️, cans🥫, drums🛢️, etc. with batch numbers. When we get a shipment of one of the products, how do we track we received (say) 10 cans each of 5L of a product and maybe we received 10 cans of another
      • Easy third party collaboration: Zoho Flow Integration

        Third-party integrations extend your project functionality with improved workflow, and data processing. With Zoho Flow integration you can include multiple third party actions into your project or task automation. Add Zoho Flow action in Workflow rules
      • Zoho Inventory - How to pay a supplier up front then receive multiple deliveries

        How do we manage situations where we pay a supplier up front, then the receive the products in increments? Example Workflow: Create Purchase Order > Receive Bill for full amount > Receive Items 2 or more deliveries. Currently, once a Bill is created against
      • Introducing Configure, Price, Quote (CPQ) in Zoho CRM | Public early access 2023

        Greetings Customers! We're excited to announce that the CPQ feature will soon be available in Zoho CRM and accessible to all accounts using the Professional, Enterprise, and Ultimate editions. We've opened this feature to select customers, and it'll be
      • how to edit the converted lead records?

        so I can fetch the converted leads records using API (COQL), using this endpoint https://www.zohoapis.com/crm/v5/coql and using COQL filter Converted__s=true for some reasons I need to change the value from a field in a converted lead record. When I try
      • Zoho Bookings <> CRM integration

        Hello Zoho community! We are enabling our Zoho Bookings <> CRM integration. What is the workflow if the integration detects that the contact already exists in the CRM? Does it create a duplicate record? Overwrite the record? Merge the record? (in this
      • Cannot reject empty expense report

        Hello, We are currently having issues with two empty expense reports where if we try to reject them, either manually or through the REST API, we get error 114016, which says some of the expenses have already been billed and must be removed. I'd appreciate
      • Use of Zia within Forms

        I have noticed that recently you have added Zia to help create forms from scratch. Would it be possible to add Zia functionality to free text fields for form submissions or if this is already on the roadmap an ETA for this please? We have a lot of field
      • Default in fields on Form B based on the user selection in Form A

        Hi Everyone, I have added an action button to a form report to bring up a new form based on user selection, see it indicated in red below: Then when the ne form loads, I want to default in some of the fields based on the record the user was selected on.
      • Auto-sync field of lookup value

        This feature has been requested many times in the discussion Field of Lookup Announcement and this post aims to track it separately. At the moment the value of a 'field of lookup' is a snapshot but once the parent lookup field is updated the values diverge.
      • Next Page