Creator Help

Create Records in Zoho Subscriptions

 Overview

Using zoho.subscriptions.create() Deluge task in Zoho Creator, you can create records in supported modules of Zoho Subscriptions. You can make use of different workflow options in Zoho Creator to automate this process . Create customers, generate subscriptions for customers and create PCI compliant hosted pages for new subscriptions, as and when you need to, using this task. For example, you can execute "form actions" in Zoho Creator to create a customer in Zoho Subscriptions or generate a subscription for an existing customer in Zoho Subscriptions.

 Supported Modules

  • Customers
  • Subscriptions
  • Hosted Pages

 Syntax

<response> = zoho.subscriptions.create(<module>, <orgID>, <params>);

where,
<response> is the map variable returned as response. It contains the details of the newly created record. 
<module> is the name of the Zoho Subscriptions Module where the record will be added. For example, "Customer" refers to the Customer module.
<orgID> refers to your organization ID as specified in Zoho Subscriptions. To know your organization ID, click on <YourOrganizationName> > Manage Organizations, from the top-right corner of your Zoho Subscriptions Home page. Click here to learn more about Org ID.
<params> is the map variable that holds the key,value pairs. The map key is the label name as specified in the Zoho Subscriptions module and the map value is the field value as submitted in the ZC form. For example, "display_name" : input.Customer_Name . Here, "display_name" is the label name as specified in the Zoho Subscriptions module and "input.Customer_Name" refers to the value specified in the Contact_Name field in the Zoho Creator form.

Note:

  • All the parameters listed above are mandatory. 

 Examples

1) Create a customer profile in Zoho Subscriptions using Zoho Creator form

In this example, a customer is created in Zoho Subscriptions' Customer module by adding code to a Zoho Creator form. The form consists of fields "Customer Name" and "Email". Upon submission of the form, a record gets created in Zoho Subscriptions Customer module using the data submitted.

  • Add the following scipt in the "on Success" section of your Zoho Creator form

params = map();
params.put("display_name", input.Customer_Name);
params.put("email", input.Email);
response = zoho.subscriptions.create("customers", "12345678", params);

  • Submitting the form will create a new customer record in your Zoho Subscriptions with the specified customer name and email.

where, 
customers is the name of your Zoho Subscriptions Module where the record will be added.
12345678 is a sample organization ID. Replace it with your organization ID.
"display_name" and "email" are the label names as specified in the Zoho Subscriptions Customers module. "input.Customer_Name" and "input.Email" refer to Zoho Creator form fields.

 Response Format

Following is the response format returned by Zoho Subscriptions to Zoho Creator:

{
"message":"The customer has been added.",
"code":0,
"customer":{
"default_templates":{
"creditnote_template_id":"",
"invoice_template_id":""
},
"phone":"",
"payment_terms":0,
"payment_terms_label":"Due On Receipt",
"price_precision":2,
"updated_time":"2015-03-10",
"outstanding_receivable_amount":0,
"shipping_address":{
"zip":"",
"fax":"",
"street":"",
"state":"",
"country":"",
"city":""
},
"first_name":"",
"company_name":"",
"zcrm_contact_id":"",
"currency_symbol":"Rs.",
"outstanding":0,
"currency_code":"INR",
"custom_fields":"[]",
"currency_id":"115888000000000099",
"status":"active",
"pricebook_id":"115888000000011001",
"zcrm_account_id":"",
"unused_credits":0,
"display_name":"zoho",
"email":"zohocorp@gmail.com",
"last_name":"",
"created_time":"2015-03-10",
"notes":"",
"customer_id":"115888000000046001",
"mobile":"",
"billing_address":{
"zip":"",
"fax":"",
"street":"",
"state":"",
"country":"",
"city":""
}
}
}

If for some reason, the execution fails, the error response will be in the following format:

Error Response for - Customer diplay_name parameter not passed.

{"message":"Enter valid Customer Name","code":3013}

Customer display_name is a mandatory parameter.

Share this post : FacebookTwitter

Still can't find what you're looking for?

Write to us: support@zohocreator.com