Set value of field in task + Convert simple SendMail task to Custom Action on report

Set value of field in task + Convert simple SendMail task to Custom Action on report

Hi All!
Hope someone might help me on this.

 

I have a form called “New_Services”

This form has 2 equal functioning tasks placed at:

1) OnAdd+OnSuccess

2) OnEdit+OnSuccess

The task performs a very simple script

The form has a dropdown field with 3 options.

When the user selects option 1:

“if” dropdown equals “choice 1” then “SendMail”

(the SendMail gets the “to:” field from a lookup to:Driver[ID == input.Driver].email_driver)

And displays a “success message: email sent”

When the user selects option 2:

“if” dropdown equals “choice 2” then no email is to be sent

And displays a “success message: no email sent”


Please see below the code

  1. if(input.dropdown  ==  "Send email to provider")
    {
        sendmail
        [
            from:zoho.adminuserid
            to:Driver[ID == input.Driver].email_driver
            bcc:"company@companyemail.com"
            reply to:"company1@companyemail.com"
            subject:"Notification of new service " + input.date_and_time
            message:"<font face=\"verdana\">Dear <b>" + Driver[ID == input.Driver].driver + "</b> <br><br>please find below details of the service to perform:<br><br>\n</font><table style=\"border-collapse: collapse;\" height=\"401\" cellspacing=\"5\" cellpadding=\"10\" border=\"1\" width=\"677\">\n  <tbody>\n    <tr>\n      <td><font face=\"verdana\">Date and time<br></font></td>\n    <td><font face=\"verdana\">" + input.date_and_time + "<br></font></td>\n    </tr>\n    <tr>\n      <td><font face=\"verdana\">Itinerary</font></td>\n      <td><font face=\"verdana\">" + input.itinerary + "</font></td>\n    </tr>\n    <tr>\n      <td><font face=\"verdana\">Passenger</font></td>\n      <td><font face=\"verdana\">" + input.traveler + "</font></td>\n    </tr>\n    <tr>\n      <td><font face=\"verdana\">Passenger number</font></td>\n      <td><font face=\"verdana\">" + input.pax + "</font></td>\n    </tr>\n    <tr>\n      <td><font face=\"verdana\">Type of vehicle</font></td>\n      <td nowrap=\"nowrap\"><font face=\"verdana\">" + Vehicle[ID == input.Vehicle].Vehicle + "</font></td>\n    </tr>\n<tr>\n      <td><font face=\"verdana\">Assistant</font></td>\n      <td><font face=\"verdana\">" + Assistant[ID == input.Assistant].Assistant + " " + Assistant[ID == input.Assistant].phone + "</font></td>\n    </tr>\n    <tr>\n      <td><font face=\"verdana\">Notes</font></td>\n      <td><font face=\"verdana\">" + input.notes + "</font></td>\n    </tr>\n    <tr>\n      <td><font face=\"verdana\">Invoicing amount<br></font></td>\n      <td><font face=\"verdana\">Euro " + input.buying_amount + "</font></td>\n    </tr>\n  </tbody>\n</table><font face=\"verdana\">\n<span style=\"background-color: rgb(255, 255, 255);\"><br></span></font><font face=\"verdana\">Please confirm.<br><br>Thank you and best regards.<br><br><b>Company details</font></font><br>\n\n"
            content type:HTML
            attachments :template:my_template as PDF
        ]
        success message "Service added correctly and email sent to driver";
    }
    if(input.dropdown  ==  "Do not send email to provider")
    {
        success message "Service added correctly email NOT sent to driver";

     


Now my questions on the task (if it possible, and if yes how):

1)                In dropdown option 1: to add a line of code after the email has being sent, to set the value of the dropdown to option 3?

2)                In dropdown option 1: to add a line of code after the email has being sent, to set the value of a decision field (notification_sent) to true?

 

Now the big question how is possible to set this task as a custom action on the report (button on single record line displayed)?

I’m having tremendous problems fetching the right data, I believe I should use map but I can’t seem to get my head around it.

 

Many thanks to anyone that can help!