Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Infomessage not displaying for UI action

Arka Banerjee
Mega Guru

Hi All,

 

I have the below UI action, its not displaying the infomessage everytime in portal. Sometimes it does with the green info banner and sometimes it doesnt. How do I fix this. Please note that I would need to open it in a new window on top, hence why the code at the onclick function. Please help me with a workaround for this. Thanks!

 

ArkaBanerjee_0-1761290520366.png

 

 

 

function reopensop() {
var conf = confirm('Are you sure you want to Reopen this procedure?');
if (conf == false) {
return false;
}
gsftSubmit(null, g_form.getFormElement(), 'reopen');
var id = g_form.getUniqueValue();
window.open("/fi?id=sop_index_1&table=x_pfgb3_fi_sop_table&sys_id=" + id, "_top");
}
if (typeof window == 'undefined')
runReopen();

function runReopen() {
//
var bu;
if (current.subgroup != '') {
bu = current.subgroup;
} else {
bu = current.sector;
}
var approver;
var own;
var grSection = new GlideRecord('x_pfgb3_fi_sop_subgroup');
grSection.addQuery('sys_id', bu);
grSection.query();
if (grSection.next()) {
approver = grSection.approver;
own = grSection.owner;
}
var app = approver.split(',');
var finalApp = [];
var cnt = gs.getUserID();
for (var i = 0; i < app.length; i++) {
if (app[i] != cnt) {
finalApp.push(app[i]);
}
}
var fappr = finalApp.join(',');
//

var prcID = new GlideRecord('x_pfgb3_fi_sop_table');
prcID.initialize();
prcID.title = current.title;
prcID.document_type = current.document_type;
// prcID.u_retail = current.u_retail;
prcID.groupid = current.groupid; // add the copy ID
prcID.copyid = current.sys_id;
prcID.sector = current.sector;
if (current.subgroup != '') {
prcID.subgroup = current.subgroup;
}
prcID.version = current.version + 1;
prcID.approver = fappr;
prcID.owner = own;
prcID.u_contact = gs.getUserID(); //
prcID.workflow_state = 'Under Revision';
prcID.procedure_details = current.procedure_details;
prcID.purpose = current.purpose;
prcID.scope = current.scope;
prcID.policy = current.policy;
prcID.escalation_reporting = current.escalation_reporting;
prcID.additional_comments = current.additional_comments;
prcID.favorite = current.favorite;
prcID.search_terms = current.search_terms;
var nid = prcID.insert();
//action.setRedirectURL(prcID);
GlideSysAttachment.copy('x_pfgb3_fi_sop_table', current.sys_id, 'x_pfgb3_fi_sop_table', nid);
var nurl = "fi?id=createfi&table=x_pfgb3_fi_sop_table&sys_id=" + nid;
gs.addInfoMessage('Your request has been copied successfully. Please refer to <a href="' + nurl + '">this link</a> to view the procedure.');
current.workflow_state = 'Approved - Pending Update';
current.update();
gs.eventQueue('x_pfgb3_fi_sop.reopned', current, nid, '');
}

 

@Ankur Bawiskar 

2 REPLIES 2

Ankur Bawiskar
Tera Patron
Tera Patron

@Arka Banerjee 

Client side UI actions are not shown on portal

Only Server Side UI actions are shown and it should have server side code

💡 If my response helped, please mark it as correct and close the thread 🔒— this helps future readers find the solution faster! 🙏

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

Hi Ankur,

 

Can you please help with the necessary tweaks to the code, so that I can display the infomessage properly. The code is working all fine as gar as creating the new record and all is concerned, just the Infomessage seems to be lost in most cases. Would be really helpful if you can help me find a workaround