- Mark as New
 - Bookmark
 - Subscribe
 - Mute
 - Subscribe to RSS Feed
 - Permalink
 - Report Inappropriate Content
 
06-02-2021 10:06 AM
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
Solved! Go to Solution.
- Mark as New
 - Bookmark
 - Subscribe
 - Mute
 - Subscribe to RSS Feed
 - Permalink
 - Report Inappropriate Content
 
06-03-2021 09:26 PM
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
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
 - Bookmark
 - Subscribe
 - Mute
 - Subscribe to RSS Feed
 - Permalink
 - Report Inappropriate Content
 
06-03-2021 11:00 PM
- Mark as New
 - Bookmark
 - Subscribe
 - Mute
 - Subscribe to RSS Feed
 - Permalink
 - Report Inappropriate Content
 
06-03-2021 11:03 PM
So what should be the form button?
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
 - Bookmark
 - Subscribe
 - Mute
 - Subscribe to RSS Feed
 - Permalink
 - Report Inappropriate Content
 
06-03-2021 11:08 PM
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
- Mark as New
 - Bookmark
 - Subscribe
 - Mute
 - Subscribe to RSS Feed
 - Permalink
 - Report Inappropriate Content
 
06-10-2021 11:45 PM
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
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
 - Bookmark
 - Subscribe
 - Mute
 - Subscribe to RSS Feed
 - Permalink
 - Report Inappropriate Content
 
10-19-2021 04:16 AM
@Ankur Can you help me with https://community.servicenow.com/community?id=community_question&sys_id=718208ff1b4fbcd4c16b43f6fe4bcb86
Thanks
