Trigger an email notification from service portal page

Jesi Perinbaraj
Kilo Contributor

Hi All,

I have a requirement where I need to send an email from the service portal page. There are two buttons on a form and on click of one of the buttons, it should trigger an email notification with the details filled in the form. How can this be achieved using angularjs?

Thanks in advance,

Jessie

8 REPLIES 8

larstange
Mega Sage

Hi



You can generate a record directly in the outbox.


You will need to do this via a server side function: Communicating between the Client Script and the Server Script of a widget - ServicePortal.io - Servi...



Then get this server side function to generate a new mail in the outbox



var mail = new GlideRecord("sys_email");


mail.initialize();


mail.mailbox.setDisplayValue("Outbox");


mail.recipients = ("mail@mail.com");


mail.subject = ("Subject of mail");


mail.body = ("Body of mail");


mail.type = "send-ready";


mail.content_type = "multipart/mixed";


mail.insert();


Hi Lars,



Thank you for the response. Wanted to know if we can use gs.eventqueue? Also that there are two submit buttons , i think from the client controller we need to do something to differentiate it.



Regards,


Jessie


Hi Lars,



I tried the above and got an error as this is a scoped application. Below is the error -


Create operation against 'sys_email' from scope 'abc' has been refused due to the table's cross scope policy.



Any way to access the sys_email table?



Regards,


Jessie


larstange
Mega Sage

You could use the event queue but that will require that you have a relevant record to bind the event to - if you do that will be the best solution