Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-02-2025 06:14 AM
Hi All,
I am trying to create a UI action which should create an Incident from RITM form and I need help with showing up a confirmation box which asks for confirmation before proceeding with Yes/No.
If yes, it has to create Incident and If "no" it should stay on the same form/page
I know the below script I drafted below needs a lot of change. Please suggest the some solution for the same.
var ritmTable = current.getTableName();
var ritmSysID = current.getUniqueValue();
var ritmNum = current.getValue('number');
/* Construct comments and work notes
-----------------------------------------------------------------------------------------------------------------------*/
var comments = 'Incident created from ' + ritmNum;
function openinc() {
var usrResponse = confirm('Are you sure you would like to proceed?');
if (usrResponse == 'false') {
return false; //Abort submission
} else
gsftSubmit(null, g_form.getFormElement(), 'transfer_incident');
}
if (typeof window == 'undefined')
runBusRuleCode();
//Server-side function
function runBusRuleCode() {
var inc = new GlideRecord("incident");
inc.caller_id = current.request.requested_for;
//inc.assignment_group = assignmentGroup;
inc.short_description = current.short_description;
inc.cmdb_ci = current.cmdb_ci;
inc.assignment_group = current.assignment_group;
inc.business_service = current.business_service;
inc.impact = current.impact;
inc.urgency = current.urgency;
inc.description = current.variables.description;
inc.comments = comments;
inc.parent = ritmSysID;
var incSysID = inc.insert();
var incTable = inc.getTableName();
var incNum = inc.getValue('number');
GlideSysAttachment.copy(ritmTable, ritmSysID, incTable, incSysID);
current.comments = 'RITM converted to ' + incNum + '. Please use this reference from now on.';
current.setValue('state', '10');
var mySysID = current.update();
gs.addInfoMessage(gs.getMessage("Incident {0} created", incNum));
action.setRedirectURL(inc);
}TIA
@Ankur Bawiskar @Anand Kumar P @Runjay Patel @Ravi Gaurav
Solved! Go to Solution.