- 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 07:05 AM
Hi,
Sure do let me know.
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 08:05 AM
Hi Ankur,
It is not working, Should I try other than below changes.
UI Action Details
Table - XYZ
Action Name - confirm_approval
Client - Selected
onCLick - validateForm();
Script ->
function validateForm() {
var ga = new GlideAjax('UpdateRecord');
ga.addParam('sysparm_name', "updateMyRecord");
ga.addParam('sysparm_id', g_form.getUniqueValue());
ga.addParam('sysparm_table', g_form.getTableName());
ga.getXMLAnswer(function(answer){
emailClientOpenPop('sc_task');
});
}
Script Include ->
Client Callable Yes
var UpdateRecord = Class.create();
UpdateRecord.prototype = Object.extendsObject(AbstractAjaxProcessor, {
updateMyRecord: function(){
var sysId = this.getParameter('sysparm_id');
var tableName = this.getParameter('sysparm_table');
var gr = new GlideRecord('XYZ');
gr.addQuery("sys_id", sysId);
gr.query();
if (gr.next()) {
gr.u_status = 'Approved';
gr.update();
}
},
type: 'UpdateRecord'
});
- 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 10:45 PM
Thank Ankur, Jus to add I am able to to this with Scripts provided by Sai (It is working with Form Button), The only issue is I am trying to do this with bottom list button not form button. May be that is the reason it is not working. I do not want to use Form button actually.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-03-2021 10:52 PM
So what type of UI action you are currently using?
For which one it should work
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
