Welcome to Community Week 2025! Join us to learn, connect, and be recognized as we celebrate the spirit of Community and the power of AI. Get the details  

UI Action and emailClientOpenPop

ashish9
Tera Contributor

I have a button Approval on XYZ form.

 

If I click on Approval button while Client is selected and onClick event as emailClientOpenPop('sc_task');  it open the Email Pop up perfectly.

 

But if I unchecked Client it hide the onClick option and I can change the current.u_status = 'Close'; on the XYZ form.

 

But actual requirement is both think Email Client Pop up and the status update should happen simultaneously.  

 

So is it possible I can call Email Client pop up from script and at the same time it updates the status.

 

Thanks

1 ACCEPTED SOLUTION

Hi,

Script looks good.

Did you try adding logs in script include

var UpdateRecord = Class.create();
UpdateRecord.prototype = Object.extendsObject(AbstractAjaxProcessor, {

updateMyRecord: function(){

var sysId = this.getParameter('sysparm_id');

gs.info('sysId' +sysId);
var tableName = this.getParameter('sysparm_table');
var gr = new GlideRecord('XYZ');
gr.addQuery("sys_id", sysId);
gr.query();
if (gr.next()) {

gs.info('Record found');
gr.u_status = 'Approved';
gr.update();
}
},

type: 'UpdateRecord'
});

Regards
Ankur

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

View solution in original post

33 REPLIES 33

As per Sai, I am missing form button in screenshot. But I do not want Form button but bottom list ones.

So what should be the form button?

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

Actually I am using the XYZ form as a Related list which will open from sc Task form.  On SC Task there is a Related List where we are showing field of XYZ form and there are bottom list buttons from where User has to click on a bottom list button which will open a Email Pop up and at the same time change the status of XYZ form Accepted.

 

As per SAI script I have to open the record from SC Task then when Form XYZ record will open then we can send email and save at the same time.

 

I think that also is fine just 1 Click more than.

 

I will test it with your code as well. If that suits than will use that Else SAI's Code will be fine I guess.

 

Thank You

Hi,

As per your earlier comment you mentioned it didn't work with combination of client + server

So I shared the approach of only keeping UI action as Client Side and use GlideAjax

But the response marked as correct is different.

Please mark appropriate response as correct so that it helps future readers.

Regards
Ankur

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

@Ankur Can you help me with https://community.servicenow.com/community?id=community_question&sys_id=718208ff1b4fbcd4c16b43f6fe4bcb86

 

Thanks