Need to display a Dialog Box with Yes / No to Create Problem Ticket for All Priority 1 incidents

vasant Cool
Mega Guru

The below Code has been created to Automatically create a Problem Ticket for all Priority 1 Incidents. But my requirement is a dialog Box to appear with Yes/No. If you click on Yes Pbm tickets gets created. Pls Help me where to insert the Yes/No code in the below give script.

-------------------------------------------------------------------------------------------------

(function executeRule(current, previous /*null when async*/) {
var short_description =current.getValue('short_description');
var gr= new GlideRecord('incident');

gr.addQuery("short_description", short_description);
gr.query();

var prob = new GlideRecord('problem');
while(gr.next()){
prob.short_description = current.short_description;
prob.impact = current.impact;
prob.urgency = current.urgency;
prob.company = current.company;
prob.setValue('location', current.location);
prob.setValue('cmdb_ci', current.cmdb_ci);
prob.setValue('u_vendor_company', current.u_vendor_name);
prob.setValue('u_vendor_ticket_number', current.u_vendor_ticket_number);

// prob.setCategory(current.category);
prob.setValue('u_category', current.category);

var sysID = prob.insert();
current.problem_id = sysID;
var mySysID = current.update(); // where is the mySysID being used??
}
var url = 'problem.do?sys_id=' + current.problem_id;

// gs.addInfoMessage("A Problem Ticket has been created " + prob.getValue('number'));

/* creating a URL link to the newly created Problem ticket */
gs.addInfoMessage('A Problem Ticket has been created: '+
"<a href='" + url + "'>" +
prob.getValue(prob.getDisplayName()) +
"</a>" + '.');

})(current, previous);

----------------------------------------------------------------------------------------------------------------

5 REPLIES 5

Yogish Naik1
Kilo Guru
onChange() client script var choice =confirm("Press ok to create Problem"); if (choice== true) { var pr = new GlideRecord('problem') ; pr.intilize(); //map fields pr.update(); }