- 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:27 AM
Thanks SAI, It worked with Form button but I want it with bottom list button. I will test it if this can be done with bottom buttons thanks.
- Mark as New
 - Bookmark
 - Subscribe
 - Mute
 - Subscribe to RSS Feed
 - Permalink
 - Report Inappropriate Content
 
06-03-2021 11:55 AM
If you want to update record value you can only use Form button, Using list button will not update the specific record status value.
- Mark as New
 - Bookmark
 - Subscribe
 - Mute
 - Subscribe to RSS Feed
 - Permalink
 - Report Inappropriate Content
 
06-02-2021 09:17 PM
Hi,
You can try script mentioned by Sai and share us an update.
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 01:56 AM
Thank Ankur, It is opening Pop absolutely fine but not able to change the status.
UI Action Name - Confirm_Status
Clicnt is Checked
onCLick - validateForm();
Script is -
function validateForm() { //
function validateForm() {
emailClientOpenPop('sc_task');
gsftSubmit(null, g_form.getFormElement(), 'Confirm_Status');
}
if(typeof window == 'undefined')
setStatus(); //Server function
function setStatus() {
current.u_status = 'Approved';
current.update();
action.setRedirectURL(current);
}
- Mark as New
 - Bookmark
 - Subscribe
 - Mute
 - Subscribe to RSS Feed
 - Permalink
 - Report Inappropriate Content
 
06-03-2021 02:10 AM
Hi Ashis,
Only way you could do this, is to keep the UI Action Client side, and call a script include which updates the record, before opening the pop-up. (Before in the script, it shouldn't be noticable to the user.)
Kind regards,
Peter Bodelier
Help others to find a correct solution by marking the appropriate response as accepted solution and helpful.
