Update a form using custom action (from another form's report)

Update a form using custom action (from another form's report)

Requirement  

Update a form using a custom action configured in another form's report.

Use Case

In an engineering college student management application, a student may withdraw at any time of the academic year. Whenever a student applies for withdrawal, it should update the record of the student with the relevant details.  

Steps to follow

1. Create the forms with the following details:
Form
Form Link Name
Field Type
Field Name
Field Link Name
Add Student
Add_Student
Email
Email
Email
Name
Student Name
Student_Name
Date
Date Of Birth
Date_Of_Birth
Single Line
Department
Department
Single Line
Course
Course
Drop Down
  • 2017-2021
  • 2018-2022
  • 2019-2023
  • 2020-2024
  • 2021-2025
Academic Year
Academic_Year
Drop Down
  • Active (Mark as default)
  • Inactive
  • Passed-out
Student Status
Student_Status
Multi line
If inactive, please enter proof of leaving
If_inactive_please_enter_proof_of_leaving
Date
Date Of Leaving
Date_Of_Leaving
Leaving Request
Leaving_Request
Lookup (Add_Student)
Student
Student
Date ( Initial Value - zoho.currentdate)
Request Date
Request_Date
Multi-line
Reason for leaving
 
Reason_for_leaving
Decision Box
Approved
Approved
Decision Box
Rejected
Rejected
 
Now, we shall hide the If inactive, please enter proof of leaving and Date Of Leaving fields and show them if the student status becomes Inactive. Set the Reason for leaving field in the Leaving Request form as Mandatory.
 
2. Create a workflow to hide the above two fields if the Student Status value is not Inactive.
 
3. Click Add New Action and enter the below code in the Deluge Editor:
  1. if(Student_Status != "Inactive")
  2. {

  3. //Hide the below fields if the Student Status is not inactive
  4.  hide If_inactive_please_enter_proof_of_leaving;
  5.  hide Date_Of_Leaving;
  6. }
This will hide the inactive fields when the form loads.
 
Only a student can raise the Leaving Request. So, let's create a workflow during the load of the Leaving Request to fetch the details of the current logged-in student and to disable it, so that there is no modification.
 
4. Next, let's create a workflow during the load of the Leaving Request form.
 
5. Click Add New Action and add the below code to find the current logged-in student.
  1. //Get the corresponding Add_Student record from the login details
  2. input.Add_Student = Add_Student[Email == zoho.loginuserid].ID;

  3. //Disable the field to prevent further modification
  4. disable Add_Student;

An action item will be created for every record in the Leaving Request form, which will allow for approval of the corresponding request and mark the student as Inactive.
 
6. We will list only the relevant records to the administrators. Add a filter to the Leaving Request report to show only those Leaving Requests that are not Approved.
 
7. Next, let's add a report workflow for the administrators to approve the Leaving Request for a student. Click on the Leaving Request report. Click Quick View. Navigate to Configure Fields > Add Fields > Add New Button. Name the Action Item 'Approve Leaving Request'.
 
8. We shall execute this action item after confirmation. Add the following confirmation message:
  1. Execute the Approve Leaving Request action for this record for this student -  ${Add_Student.Student_Name} ?

9. Name the workflow 'Leaving Requestand click Create Workflow.

10. Click Add New Action > Deluge Script > Create your own. Add the below Deluge code to update the leaving details in the Add Student form:
  1. //Fetch the corresponding Add_Student record
  2. student = Add_Student[ID == input.Add_Student];

  3. //Set the Date Of Leaving to the current date
  4. student.Date_Of_Leaving=zoho.currentdate;

  5. //Assing the Reason for Leaving 
  6. student.If_inactive_please_enter_proof_of_leaving=input.Reason_for_Leaving;

  7. //Mark the Student Status as Inactive
  8. student.Student_Status="Inactive";

  9. //Mark the current Leaving Request record to Approved
  10. input.Approved = true;

11. Let's add another script to send an email to the student once the Leaving Request is approved. Click Add New Action > Deluge Script > Create your own. Add the below Deluge code to notify:
  1. sendmail
  2. [
  3.  from :zoho.adminuserid
  4.  to :input.Add_Student.Email
  5.  subject :"Your Leaving Request is approved!"
  6.  message :"<div><br>Hi " + input.Add_Student.Student_Name + "<br/>We are so sorry to let you go. Your request is approved.</div>"
  7. ]

12. Click Create. This will create the action item.
 
13. Although optional, we can create an action item for rejecting the Leave Request in a similar fashion. We can set the Rejected field value accordingly and explain the reason for rejection in an email.

See how it works




    Zoho CRM Training Programs

    Learn how to use the best tools for sales force automation and better customer engagement from Zoho's implementation specialists.

    Zoho CRM Training
      Redefine the way you work
      with Zoho Workplace

        Zoho DataPrep Personalized Demo

        If you'd like a personalized walk-through of our data preparation tool, please request a demo and we'll be happy to show you how to get the best out of Zoho DataPrep.

        Zoho CRM Training

          Create, share, and deliver

          beautiful slides from anywhere.

          Get Started Now


            Get started with Zoho Sign

            in a few quick steps!

            Download Help Guide





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

                        Write to us:  support@zohoforms.com


                              




                            

                          Zoho Marketing Automation

                            Zoho Sheet Resources

                             




                                Zoho Forms Resources


                                  Secure your business
                                  communication with Zoho Mail


                                  Mail on the move with
                                  Zoho Mail mobile application

                                    Stay on top of your schedule
                                    at all times


                                    Carry your calendar with you
                                    Anytime, anywhere




                                          Zoho Sign Resources

                                            Sign, Paperless!

                                            Sign and send business documents on the go!

                                            Get Started Now


                                                Zoho SalesIQ Resources



                                                    Zoho TeamInbox Resources



                                                            Zoho DataPrep Resources



                                                              Zoho DataPrep Demo

                                                              Get a personalized demo or POC

                                                              REGISTER NOW


                                                                Design. Discuss. Deliver.

                                                                Create visually engaging stories with Zoho Show.

                                                                Get Started Now











                                                                                      • Related Articles

                                                                                      • Disable Custom Actions after n times

                                                                                        Requirement  A custom action on a report has to be disabled after it is triggered three times. Use Case  We have an app to maintain customer invoices. After an invoice is created, the staff can email the invoice to the customer with the click of a ...
                                                                                      • Understand reports

                                                                                        A report is a compilation of data collected using a form in the created application. Zoho Creator incorporates reports as one of the components to complete the purpose of the application that you create. A report collates and presents information to ...
                                                                                      • Update an existing record using stateless forms

                                                                                        Requirement   Use details specified in a stateless form to modify records in the main form. Use Case   In an order management system, a customer has placed an order and wants to cancel it. The administrators allow for cancellation by accepting the ...
                                                                                      • Add data to a different application

                                                                                        Requirement Automatically add a record to a form of one application when a record is added in a different application. Use Case A Zoho creator account has two applications: Contact Management and Order Management. All the customer details maintained ...
                                                                                      • Display custom action button for specific records

                                                                                        Requirement   The custom action button in a report should be visible only for certain records, based on a condition. Use Case   An asset request app lets employees raise requests for gadgets or machines. While filling the form, employees can specify ...
                                                                                      Wherever you are is as good as
                                                                                      your workplace

                                                                                        Resources

                                                                                        Videos

                                                                                        Watch comprehensive videos on features and other important topics that will help you master Zoho CRM.



                                                                                        eBooks

                                                                                        Download free eBooks and access a range of topics to get deeper insight on successfully using Zoho CRM.



                                                                                        Webinars

                                                                                        Sign up for our webinars and learn the Zoho CRM basics, from customization to sales force automation and more.



                                                                                        CRM Tips

                                                                                        Make the most of Zoho CRM with these useful tips.



                                                                                          Zoho Show Resources