how to send ui page user input data to email as notification

srkuraku
Kilo Contributor

Developers team,

I have created UI page through UI action button as follows. When user click on HPI button on Incident form, the following UI page opens.

If user enters the data manually and   click on OK button, all   manually enter data should be delivered to email as a notification below.   How could I achieve this following email notification   format?

PS: UI page form fields are manually added and not Incident fields or System fields.

"Current Status (Executive Summary 😞 Date and Time: 9/22/2016 07:46:00 (UTC)
Incident State: Active
Retests are passing and the NOC has received improved emails for each. Dashboards and Egraph show no traffic loss in Atlanta, In addition, we are also seeing 5xx errors on multiple ADN servers in the North American Region and have received two customer complaints isolated to Level3 circuits in CPM. AppSupport HTTP has been engaged to investigate.

Bridge Info: 1-866--99940=22

Ticket Number: INC0000018

Short description: Sales forecast spreadsheet is READ ONLY

Priority: 1 - Critical

Business Area Impact: Network

Location of Impact: boston

Incident Timeline: 07:10:00 (UTC) NOC started to receive mu

Lead on Floor: INC0000008

Group of Representatives: Sis

Next Expected Update: 20 minutes"

find_real_file.png

15 REPLIES 15

Chetan Sondhi
Kilo Sage

Hi Sivaraju,



For this what you can do is that from UI page , you can store the data entered in UI page form fields in a variable in aforementioned format and pass it as parameter (parm1/arm2 ) of


gs.eventQueue(event name, Object, Parm1, Parm2 ) .When user clicks Ok button on UI Page ,create this event to trigger email notification you want to send .



The parameter value passed in parm1/parm2 can be fetched in the body of the email notification with "email.parm1" or "email.parm2".



(   The event.parm1 and event.parm2 parameters that come from the originating event can also be used within the <mail_script>. )



Please let me know if anything else is required on this.



PS - Please mark Helpful, Like, or Correct Answer if applicable.



Thanks,


Chetan





.


Hello Chetan,



Thank you for response. Could you please elaborate little more. Where you want to me to write gs.eventQueue(event name, Object, Parm1, Parm2 ) code?



I have event called" emailVIPEvent" in registrey and notification named "emailVIPNotification".   When I click on   Ok button, I am getting notification as below







find_real_file.png




Why its not giving me user entered input data in email?     Could you please help me out. Please find my client script and processing script below. Thanks.



client script


function hpiCommunication() {


    alert('sendEmail2');


    // var comments = gel("comments").value;


    return true;


    // GlideDialogWindow.get().destroy();


    // g_form.setValue("comments", comments);


    // Add code to call Email registry


    // gs.eventQueue("incident.updated", current, gs.getUserID(), gs.getUserName());


    // gs.addInfoMessage("test");


}




Processing script:



var gr = new GlideRecord('incident');




gr.addQuery('number', number);


gr.query();


if(gr.next()){


  gs.addInfoMessage('event Queue...');


  gs.eventQueue("emailVIPEvent", current, gs.getUserID(), gs.getUserName());


}


//response.sendRedirect('incident.do?sys_id='+sys_id);


response.sendRedirect('incident_list.do?sysparm_userpref_module=b55fbec4c0a800090088e83d7ff500de&sysparm_query=active=true^EQ&active=true');


gs.addInfoMessage('Mail has been sent.');


Chetan,



Its not working for me well.   Correct me If   I am doing it wrongly



find_real_file.png


find_real_file.png



--Sivaraju


Chetan Sondhi
Kilo Sage

Hi Sivaraju ,



Please find the below script for your reference :



For e.g. In UI Page HTML you have


<input type="text" class="form-control input-lg" id="ticket_number" name="ticket_number" value="" autocomplete="off">  


<input type="select" class="form-control input-lg" id="list_of_customers" name="list_of_customers" value="" autocomplete="off">  


<input type="text" class="form-control input-lg" id="location_of_impact" name="location_of_impact" value="" autocomplete="off">  



Processing script:


var HPITemplate = '';


HPITemplate += "Ticket No. : "+ticket_number+"\n";


HPITemplate += "List Of Customers : "+list_of_customers+"\n";


HPITemplate += "Location of Impact: "+location_of_impact+"\n";




gs.addInfoMessage('event Queue...');


gs.eventQueue("emailVIPEvent", current, gs.getUserID(), HPITemplate);




//response.sendRedirect('incident.do?sys_id='+sys_id);


response.sendRedirect('incident_list.do?sysparm_userpref_module=b55fbec4c0a800090088e83d7ff500de&sysparm_query=active=true^EQ&active=true');


gs.addInfoMessage('Mail has been sent.');



And in the body of the email notification :


<mail_script>


event.parm2     // HPI form data fetched from UI page .


</mail_script>



Please go through this and in case any confusion , share the HTML of your UI page I will create script for that.  



PS - Please mark Helpful, Like, or Correct Answer if applicable.



Thanks,


Chetan