Disable Custom Actions after n times

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 button. However, to avoid sending multiple emails, the button has to be disabled if it is clicked three times, which means a maximum of three emails can be sent for each customer.

Steps to follow 

1. Create two forms with the following details:
Form
Form Link Name
Field Type
Field Name
Field Link Name
Customers
Customers
Name
Customer Name
Customer_Name
Email
Customer Email
Customer_Email
Invoices
Invoices
Lookup(Customers)
Customer
Customer
Date
Invoice Date
Invoice_Date
Subform
  • Single Line
  • Number
Order
  • Product
  • Quantity
Order
  • Product
  • Quantity
 
 
Currency
Total Amount
Total_Amount
 
 
Number
Number of emails sent
Number_of_emails_sent
 
The Number of emails sent field is used to disable the button once the limit is reached. Set an initial value 0 to it.

2. Let's disable the Number of emails sent field so that it cannot be edited manually. Create a workflow with the following details.

3. Click Add New Action and select Disable fields. Next, select the field Number of Emails sent.               

4. Now, let's create an invoice template that needs to be sent to the customers. Navigate to Settings > Record Templates, and create a record template by selecting From a template.

5. Select the first template under Invoices.

6. Select the base form as Invoices as displayed below, and name it 'Invoice'.
 
We have made minor changes to the template and created the following template.

7. Next, let's add an action item that will help us send emails on the click of a button. Select All Invoices report, and click + under Quick View > Actions.

8. Create an action item with the following details. Click CREATE WORKFLOW.

9. Click Add New Action, then select Deluge Script.

10. Click Create your own, then save the following script.
  1. // Increment the Number_of_emails_sent field so that it can be used as counter till its value reaches 3
  2. input.Number_of_emails_sent = input.Number_of_emails_sent + 1;
  3. // Fetch the email address of the customer to which the invoice will be sent
  4. customer_record = Customers[ID = input.Customer];
  5. customer_email=customer_record.Customer_Email;
  6. // Send an email to the fetched email address with the invoice template
  7. sendmail
  8. [
  9. from :zoho.adminuserid
  10. to :customer_email
  11. subject :"Zylker invoice"
  12. message :"Please find the invoice for your recent purchase"
  13. Attachments :template:Invoice:Invoices input.ID as PDF
  14. ]

15. Click CREATE to save the action item with the script.

16. Now, we will list the action item in the report. Click All Invoices report > Configure Fields for Web.


17. Click + Add Fields and select the Send Email button.

The button will now be listed in the Invoices report.

See how it works         

 

Points to note  


    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

                                                                                      • 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 ...
                                                                                      • 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 ...
                                                                                      • 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 ...
                                                                                      • Extract contents of a ZIP file and email the extracted files

                                                                                        Requirement   Use Deluge to extract a ZIP file and email the extracted files with the click of a button. Use Case   An HR management application contains three forms: Add Employee, Employee Payslips, and Download My Payslips. The Add Employee form ...
                                                                                      • Custom actions

                                                                                        This API service lets you manage the different functionalities in a report. Custom action Methods performCustomAction(withActionID:onRecordIDs:in:completionHandler:)This performs the custom action on the report.   ...
                                                                                      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