Creator Help

Auto-populate other form fields in the application based on the selection made to a CRM field type

The CRM Field type is used to fetch values from Zoho CRM, within a Zoho Creator form. This feature is illustrated with the help of an example.  In the sample application Fetching CRM records using ID, select a Product, from the CRM field named “Product”. This will auto populate the “Unit Price” and “Quantity Available” fields, for the selected product. To do this, we have added the following script to the “on user input” block of the “Product” field.

crmResp = zoho.crm.getRecordById(“Products”, input.Product_ID);

input.Unit_Price = (crmResp.get(“Unit Price”)).toDecimal();

input.Quantity_Available = (crmResp.get(“Qty in Stock”)).toLong();

where,

zoho.crm.getRecordById is the deluge task to get records from a CRM module, based on the ID field. Refer related help doc for more details.

  • Products is the CRM module name
  • Product_ID is the field ID name of the CRM field “Product”
  • crmResp is the map variable returned by CRM as response which contains the product details like “Unit Price”, “Qty in Stock” etc and its value as key,value pairs.
  • crmResp.get() returns the value of the specified key and updates it in the specified field
  • input.Unit_Price refers to the field name in the Zoho Creator form
  • input.Quantity_Available refers to the field name in the Zoho Creator form.

To install the application to your account and view the script:

  • Select Options ->Copy Application from the top-right corner, to copy the application.
  • From your home page, click on the Edit link next to your application, to display the edit mode of the application.
  • Select the Script tab, to view the scripts added to the form/fields.

For example, to view the above script, select Field Actions ->Products ->On user input block from the Script tab of the Products form.

Top