Create custom buttons for multiple records using form object

Create custom buttons for multiple records using form object

Hey Creators!

It's learning time!

Requirement

Perform actions for multiple records in a single button-click using a form object.

Sample Use-case

In an employee management app, the HR needs to send a mail on a button-click to all employees regarding a mandatory training session.

Logic 

  1. From the respective report's (here, All Employee Info) quick view, create a button for multiple records. 
      When you choose for each record, the workflow is triggered for every record you select. However, when you choose a collection of records, the workflow is triggered only once for multiple records. 



2. Add an action, choose Deluge Script, and click Create your own. Copy the code shown below. 

  1. void Notifyemployee(Employee_Info Emp)


Here, Emp is the form object that holds a collection of records from the Employee info form.

We'll pass this form object as an argument to this function. To iterate each record before triggering a mail, let's drag and drop for each task and add a send mail task. 


  1. {
  2. for each rec in Emp
  3.     {
  4. sendmail
  5. [
  6. from :zoho.adminuserid
  7. to : rec.Employee_Email
  8. subject : "Yearly session on Cyber Security Awareness"
  9. message :("Hi <br>" + rec.Employee_Name) + "<br><br>You're invited to attend our yearly session on <b> Cyber Security Awareness </b> scheduled for <b> 15th December, 2024 </b>. <br>Join us in the Conference Hall as we dive into essential practices and strategies to protect both personal and organizational data in today’s digital world.<br><br>Thanks and Regards<br>HR Team"
  10. ]
  11. }
  12. }

         rec.Employee_email dynamically sends the mail to all the employees stored in the Emp variable.

         rec.Employee_Name  fetches the respective employee names.

         Save the function.

         Choose the form object as the field name from the dropdown.

         Now, save and click Done.

         Click Create

         The button is ready. 

Output





 

Now, it's your turn to create buttons to execute actions for multiple records in a single click.

That's all for now.

Feel free to share your suggestions, queries, or thoughts in the comment box below.

Thank you!