Pop Up confirmation message in UI action does not work for creating incident
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-12-2023 02:07 AM
Hi,
I have created a UI action 'Create Incident' on the HR case and it was working fine. Additionally, I wanted to add a pop-up confirmation message and clicking OK should let the user create an incident or else stay on the same form. But this code does not run and clicking on UI action is not creating any incident. Please have a look at the code I used below and help me understand what is wrong with it.
/****************************************************************************************************************?
Thanks in Advance,
RS
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-12-2023 03:42 AM
seems this could be the issue, I have seen this failing.
"answer == true"
can you please try this?
function createInci() {
var answer = confirm("Are you sure that you want to go ahead with creating an incident");
if (answer == true) {
gsftSubmit(null, g_form.getFormElement(), 'createInc');
} else {
return false;
}
if (typeof window == 'undefined')
resolveIncidentFunction();
function resolveIncidentFunction() {
var gr = new GlideRecord('incident');
gr.initialize();
gr.caller_id = current.opened_for;
gr.short_description = current.short_description;
gr.description = current.rich_description;
var inc = gr.insert();
gs,log("POPUP" + inc );
GlideSysAttachment.copy('sn_hr_core_case', current.sys_id, 'incident', inc); //copies attachment if any can be commented if required.
current.update();
action.setRedirectURL(gr);
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-12-2023 04:17 AM
Yes, this also did not let me create an incident. No log messages.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-12-2023 04:20 AM
what do you see from this?
do you get any popup?
function createInci() {
var answer = confirm("Are you sure that you want to go ahead with creating an incident");
alert(answer);
alert(answer == true);
if (answer == true) {
gsftSubmit(null, g_form.getFormElement(), 'createInc');
} else {
return false;
}
if (typeof window == 'undefined')
resolveIncidentFunction();
function resolveIncidentFunction() {
var gr = new GlideRecord('incident');
gr.initialize();
gr.caller_id = current.opened_for;
gr.short_description = current.short_description;
gr.description = current.rich_description;
var inc = gr.insert();
gs,log("POPUP" + inc );
GlideSysAttachment.copy('sn_hr_core_case', current.sys_id, 'incident', inc); //copies attachment if any can be commented if required.
current.update();
action.setRedirectURL(gr);
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-12-2023 06:01 AM
The confirmation box comes always. The below piece of code runs but not the server side one
function createInci() { var answer = confirm("Are you sure that you want to go ahead with creating an incident"); alert(answer); alert(answer == true); if (answer == true) { gsftSubmit(null, g_form.getFormElement(), 'createInc'); } else { return false; }
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-14-2023 12:13 AM
yes, but what values do you see in those alert boxes? true false after you select ok? Can you send screenshots?
Thanks
Harshad