Requirement
Handle errors that occur when user enters an incorrect value.
Use case
A company uses
Zoho Recruit to maintain interview and candidate details. To let their candidates know their status, the company uses a
Zoho Creator form. The candidates can enter their
IDs and view their
statuses. Also, the error that occurs when a candidate enters an incorrect ID is handled and a custom message is displayed.
Steps to follow
In this tutorial, the Candidate Status Without Error Handling form was created only for demonstration purpose. You may refrain from creating this form and skip steps 10 and 11 if needed.
Form | Form Link Name | Field Type | Field Name | Field Link Name |
Candidate Status | Candidate_Status | Single Line | Candidate ID | Candidate_ID |
Single Line | Status | Status |
Let’s now create 2 identical forms to demonstrate how the use case works with and without error handling.
2. Create two
stateless forms by
duplicating the
Candidate Status form and name them as
Candidate Status With Error Handling and
Candidate Status Without Error Handling.
Note: Stateless form’s field values cannot be accessed on submit of the form since data will not be stored in Zoho Creator. Therefore in this tutorial, the status will be fetched from Zoho Creator on user input of Candidate ID field.
Let’s now remove the default buttons since they are not required for our use case.
3. Navigate to
Form Properties and delete the
Submit and
Reset buttons from both the stateless forms.
Disable the Status field of Candidate Status - With Error Handling form so it cannot be modified by the candidates.
5. In the Deluge editor, save the following script to disable the Status field.
Disable the Status field of the Candidate Status - Without Error Handling form so it cannot be modified by the candidates.
7. In the Deluge editor, save the following script to disable the Status field.
8.
Create a connection with the following details. This connection will be used in
step 10 and
12 to fetch candidate data from
Zoho Recruit.
9. Now
create another workflow with the following details to populate the Status field with values fetched from Zoho Recruit. This workflow includes error handling.
10. In the Deluge editor, save the following script to fetch data from Zoho Recruit based on the supplied record ID. The code is written within a try catch block to display a custom message if an error occurs.
- try
- {
- // Fetches record from Zoho Recruit based on the record ID
- res = invokeurl
- [
- url :"https://recruit.zoho.com/recruit/v2/Candidates/" + input.Candidate_ID
- type :GET
- connection:"recruit_oauth_connection"
- ];
- // Extracts status from the fetched record
- input.Status = res.get("data").get(0).get("Candidate_Status");
- }
- catch (e)
- {
- // Displays a custom alert if an incorrect candidate ID is supplied
- alert "The entered candidate ID seems to be incorrect. Please verify. For further queries, reach us at support@zylker.com.";
- }
Note: Steps 10 and 11 are the repetition of steps 8 and 9 but without error handling. This is included in this tutorial to demonstrate how the use case works if error handling is not implemented.
11.
Create another workflow with the following details to populate the
Status field with values fetched from
Zoho Recruit. This workflow doesn't include error handling.
12. In the Deluge editor, save the following script to fetch data from Zoho Recruit based on the record ID supplied.
13.
Publish the
Candidate Status With Error Handling form and share the
permalink with the candidates. This allows the candidates to access the form without a Zoho Creator account.
See how it works
- Zoho Recruit API
- Duplicate a form
- InvokeUrl task
- Alert task
- Publish a form