Dynamic Form & Acceptance Criteria Hack for Zoho Creator

The Zolar system is made up of tightly integrated apps orbiting around CRM. Today, we’re gonna show you how to exploit the Zoho Creator x CRM integration in a slightly unorthodox, but innovative way.

If you found this useful, check out our other Zoho training resources!

Cool Ideas to use the Code

Suppose you’re dealing with a Creator Form that has complex requirements and acceptance criteria. On top of that, these requirements and criteria are subjected to periodic changes. To constantly hard-code these things into the script can be both tedious and unscalable.


This workaround establishes a dynamic link between Creator and CRM allowing users to simply set the criteria they desire on a record in a CRM custom module with 0 coding knowledge needed.


Fasten your seatbelts cause this will be a long ride.

Case Study

To aid the illustration, we’re going to use a case study. Imagine you’re running a school for online courses where you have a Creator Form set up for enrollment. For every course, there is a standard set of questions as well as a few unique ones. Upon submission of the form, you want to either accept or reject the applicants based on unique criteria that are unique to each course.

Breakdown

Before we dive into the configuration and codes, let’s go through the breakdown of the idea.

CRM

First, we’re going to create a custom module in CRM. Then, we’ll create records in the module for each Course Type in which the questions and acceptance criteria will be configured via custom fields that mirror certain questions in the Creator Form.

Creator

Next, we’ll write an “on user input” script on Creator to dynamically populate picklist values for certain question fields from the CRM configuration based on selected Course Type. A “Submission” script will be written to fetch the acceptance criteria set in CRM, and execute the acceptance/rejection actions.

CRM Configuration

“Qualification Criteria” Module

Create a new module called “Qualification Criteria”, and in there, create records for each Course Type that you have.

“Course Type” Custom Field

This field will be used as a trigger to load certain course-specific picklist values on Creator, as well as for referencing the right course acceptance criteria.

Other Custom Fields

Create custom fields in CRM for each question in your Creator Form that is part of your acceptance criteria. These custom fields can be divided to three types:

  • Yes/No Questions
  • Multi-Select Questions
  • Unique Qualifiers

Yes/No Questions

Use a picklist field for this and set the options as “Yes”, “No” and “N/A”. The value that you set here will be referenced by the Creator script as the acceptance criteria. If this question is not applicable to the Course Type, select “N/A” for the value.

Multi-Select Questions

Multi-select is used for questions with multiple selections where as long as the applicant selects one of the required answers, he/she is accepted

  • For example, in your online Management Course, you only want to accept applicants with management qualification in their current jobs. If the applicant selects “Manager”, “Director” or “Supervisor”, he/she is good to go. Anything else results in rejection.

Unique Qualifiers

This allows you to dynamically populate picklist values in Creator from CRM as well as set a more customizable acceptance criteria. It should be an entire section on the record with a parent field (where the criteria filter kicks in), followed by a few child fields (for dynamic picklist population).

Parent Field

Here, users can determine whether applicants are required to select All/ Any 1/ Any 2/ Any 3/ None of the child field values to be accepted. If it is “N/A”, the script will bypass this qualification criteria.

Child Fields

These fields will later be programmed to populate the picklist values on the Creator Form. In the example below, if the applicant select “Any 1” of the “Applicable to Me” child fields, they will be accepted to the course. The beauty of this is that, if the criteria/value needs to be changed at any point of time, anyone can do it by simply reconfiguring the fields.

Note: “TAG” is used here to add tags on the applicant records later based on value(s) input on Creator to assist sorting.

BONUS: Partner Field

This is arbitrary and may not be necessary for most but here it is in case you ever need it. The idea of a “Partner Field” is to account for situations where the standard acceptance criteria does not apply. For example, your school is working with several organizations that direct applicants to you . For these applicants, you would want to have a different set of criteria, or perhaps have some of them waived.


To account for these special cases, you can create separate records for the Course Type for specific Partners. For example, you have the general “Zoho Master Class” record that applies to all. Now, you can create a few customized records labelled “Zoho Master Class (Organization Name)” with the Partner Field filled with the Organization Name. In these records, you can have custom configurations set for different organizations.

Note: For this config, “Organization Name” should be a field on the Creator Form for applicants to input


Suggestion: You can even create a participation code field where students could obtain from the organizations. Upon input of the code, the “Organization Name” will be auto-populated as a hidden field.

CREATOR Configuration

Here’s where the magic happens!

Disclaimer: the script extracts below are made based on the case study. Please change the API names/modify the structure according to your application accordingly.

Dynamic Picklist Script

Create a workflow on Creator with “user input of a field” as the trigger.

On input of the Course Type, the script searches for the “Qualification Criteria” record on CRM based on the Course Type input in the Creator Form. It then iterates through all the “Applicable To Me” fields and populates the picklist values on Creator if the value is not null.

Some string manipulation is used within the loop to separate the values and the “tags” which are then used to create a map of “value : tags” stored in a hidden field called “TagInfo” on Creator (you can use to add tags later during submission).
				
					qualificationrecord = zoho.crm.searchRecords("Qualification_Criteria","Course_Type:equals:" + input.Course_Type);
if(qualificationrecord.size() > 0)
{
	q = qualificationrecord.get(0);
	taglist = "";
	applist = List();
	if(q.get("Applicable_to_Me_1") != null)
	{
		applist.add(q.get("Applicable_to_Me_1").getPrefix("TAG:").trim());
		taglist = taglist + "\"" + q.get("Applicable_to_Me_1").getPrefix("TAG:").trim() + "\"" + ":" + "\"" + q.get("Applicable_to_Me_1").getSuffix("TAG:").trim() + "\"" + ",";
	}
	if(q.get("Applicable_to_Me_2") != null)
	{
		applist.add(q.get("Applicable_to_Me_2").getPrefix("TAG").trim());
		taglist = taglist + "\"" + q.get("Applicable_to_Me_2").getPrefix("TAG:").trim() + "\"" + ":" + "\"" + q.get("Applicable_to_Me_2").getSuffix("TAG:").trim() + "\"" + ",";
	}
	if(q.get("Applicable_to_Me_3") != null)
	{
		applist.add(q.get("Applicable_to_Me_3").getPrefix("TAG").trim());
		taglist = taglist + "\"" + q.get("Applicable_to_Me_3").getPrefix("TAG:").trim() + "\"" + ":" + "\"" + q.get("Applicable_to_Me_3").getSuffix("TAG:").trim() + "\"" + ",";
	}
	if(q.get("Applicable_to_Me_4") != null)
	{
		applist.add(q.get("Applicable_to_Me_4").getPrefix("TAG").trim());
		taglist = taglist + "\"" + q.get("Applicable_to_Me_4").getPrefix("TAG:").trim() + "\"" + ":" + "\"" + q.get("Applicable_to_Me_4").getSuffix("TAG:").trim() + "\"" + ",";
	}
	if(q.get("Applicable_to_Me_5") != null)
	{
		applist.add(q.get("Applicable_to_Me_5").getPrefix("TAG").trim());
		taglist = taglist + "\"" + q.get("Applicable_to_Me_5").getPrefix("TAG:").trim() + "\"" + ":" + "\"" + q.get("Applicable_to_Me_5").getSuffix("TAG:").trim() + "\"" + ",";
	}
	if(applist.size() > 0)
	{
		show Applicable_To_Me;
	}
	for each  a in applist
	{
		input.Applicable_To_Me:ui.add(a);
	}
	input.TagInfo = "{" + taglist.removeLastOccurence(",") + "}";
}
else
{
	hide Applicable_To_Me;
}
				
			

Acceptance Criteria Script

Create another workflow on Creator with “successful form submission” as the trigger.

Get the right record on Qualification Criteria

Based on the form input, the script will find the Qualification Criteria record based on the Course Type and check if it’s a “General” criteria or a special organization-specific criteria.

				
					qualificationrecords = zoho.crm.searchRecords("Qualification_Criteria","Course_Type:equals:" + input.Course_Type);
usepartnercriteria = false;
for each  r in qualificationrecords
{
	if(r.get("Partner") != null)
	{
		if(Organization_Name = ifNull(r.get("Partner").get("name"),"Nope"))
		{
			usepartnercriteria = true;
			partnercriteria = r;
		}
	}
	else
	{
		criteria = r;
	}
}
if(usepartnercriteria = true)
{
	criteria = partnercriteria;
}
				
			

Set the Counters

  • Before parsing through the criteria, the default value of the result is set as “Accepted”. At any point of time when an applicant selects the “wrong” answer, the result variable will be changed to “Rejected”. If the applicant goes through all the criteria and passes, the result variable will remain “Accepted”.
  • Variable reason and reason_admin are used to build the fail message for the reference of both the applicants (via email) and the CRM users (via Notes in the Contact record) respectively.
				
					q = criteria;
applist = List();
result = "Accepted";
reason = "";
reason_admin = "";
				
			

Yes/No Field Criteria

If the Creator Form input to the question is not equivalent to the value selected in CRM, it will result in the applicant getting rejected. The reason for rejection is recorded in the respective variables.

Note: This is an example script. Change the field name (“Are_you_above_18”) accordingly.

				
					if(q.get("Are_you_above_18") != "N/A")
{
	if(Are_you_above_18 != q.get("Are_you_above_18"))
	{
		result = "Rejected";
		reason = reason + "• You need to be above 18 years old to join this course." + "\n";
		reason_admin = reason_admin + "• Is not above 18 years old." + "\n";
	}
}
				
			

Multi-Select field with Specific Options to Select

If the option(s) that the applicant select is/are not in the CRM multi-select field, it will result in rejection.

Note: This is an example script. Change the field name (“Reason_for_taking_this_course”) accordingly.

				
					mainreason = q.get("Reason_for_taking_this_course");
if(mainreason != "N/A")
{
	if(mainreason.size() > 0 && !mainreason.contains(input.Reason_for_taking_this_course))
	{
		result = "Rejected";
		reason = reason + "• Your reason for taking this course is not what we are looking for." + "\n";
		reason_admin = reason_admin + "• Selected the wrong reason for taking the course." + "\n";
	}
}
				
			

Unique Qualification Criteria

This script accounts for every possible criteria the user may have set in CRM (All, Any 1/2/3, None, Any, N/A). Applicants will be rejected if they do not meet the criteria set.

				
					if(q.get("Applicable_To_Me_Requirements") != "N/A")
{
	if(q.get("Applicable_To_Me_Requirements") = "All")
	{
		iterator = {1,2,3,4,5};	// Change to the number of “child” fields you have in the “Applicable to Me” section in CRM
		n = 0;
		for each  i in iterator
		{
			fieldname = "Applicable_To_Me_" + i;
			if(q.get(fieldname) != null)
			{
				n = n + 1;
			}
		}
		if(Applicable_To_Me.size() != n)
		{
			result = "Rejected";
			reason = reason + "• You needed to select all of the 'Applicable to Me' options." + "\n";
			reason_admin = reason_admin + "• Did not select all of the 'Applicable to Me' options." + "\n";
		}
	}
	else if(q.get("Applicable_To_Me_Requirements") = "None")
	{
		if(Applicable_To_Me.size() != 0)
		{
			result = "Rejected";
			reason = reason + "• You needed to select NONE of the 'Applicable to Me' options." + "\n";
			reason_admin = reason_admin + "• Selected one of more of the 'Applicable to Me' options." + "\n";
		}
	}
	else if(q.get("Applicable_To_Me_Requirements").contains("Any"))
	{
		if(Applicable_To_Me.size() < q.get("Applicable_To_Me_Requirements").right(1).toLong())
		{
			result = "Rejected";
			reason = reason + "• You need to have chosen at least " + q.get("Applicable_To_Me_Requirements").right(1).toLong() + " of the 'Applicable to Me' options." + "\n";
			reason_admin = reason_admin + "• Did not select at least " + q.get("Applicable_To_Me_Requirements").right(1).toLong() + " of the 'Applicable to Me' options." + "\n";
		}
	}
}
				
			

Acceptance/Rejection Actions

After iterating through all the criteria, you now have the final verdict of the application (pass/fail). From here, you can set the necessary acceptance/rejection actions.

  • If the applicant is Rejected:
    • Build the fail messages for the applicant and CRM user as collected by the “reason” and “reason_admin” variables.
    • Set the necessary rejection actions. In this example, we do the following (functions not included in the script for brevity):
      • Email the rejected applicants with the fail message.
      • Create/ Update Contact in CRM with a Note containing the fail reason and other necessary fields.
      • Redirect applicant to your website homepage.
  • If the applicant is Accepted
    • Set the necessary acceptance actions. In this example, we do the following (functions not included in the script for brevity):
      • Create/ Update Contact in CRM with necessary fields.
      • Assign a Program Coordinator for the applicant.
      • Create an Invoice with the applicant details.
      • Redirect applicant to the Invoice payment page.
				
					if(result = "Rejected")
{

  //Construct the fail message
	failmessage = "Dear " + input.First_Name + " " + input.Last_Name + "," + "\n\n" + "Sorry, you were not accepted for the " + input.Course_Type + " Course. See below for the reason(s):" + "\n" + reason + "\n" + "Thank you for your application.";
	failmessage_admin = "This Contact was just Rejected from an application for " + input.Course_Type + ". Here are the reasons:" + "\n" + reason_admin;
  
  //Insert your rejection actions here
  
}
else
{

  //Insert your acceptance actions here
  
}
				
			

Click here to copy the scripts. For more Zoho-wizardry, check out our GitHub page.

Contact Us!

Book a free 30-minutes consultation with a Zoho expert or send us an email

Related Resources