1)make attachment mandatory on form submission
Answer:-USE Before BR
Path:- system navigator>Business rule
CODE:-
if(current.hasAttachments()==true){
gs.addInfo("has attachment");
}
else{
gs.addErrormassage("no attachment");
current.setAbortAction(true);
}
2) remove duplicate records while loading data from temp table to target table
Answer:-USE Before BR
Path:- system navigator>Business rule
CODE:-
var gr=new GlideRecord("import set table");
gr.addQuery("serial_number",current.serial_number);
gr.setLimit(1);
gr.query();
if(gr.getRowCount()>1){
gs.log("aborting insertion of serial number "+current.serial_number+"already exits");
current.setAbortAction(true);
return;
}
3) auto populate logged in user into caller feild
Answer:-USE client script
Path:- system navigator>client script ONLOAD
CODE:-
if(g_form.isNewRecord()){
g_form.setValue("caller_id",g_user.userID);
}
4) set priority high when caller of the incident is Admin
Answer:-USE client script
Path:- system navigator>client script ONLOAD
CODE:-
function onLoad(){
g_user.hasRole("admin",true);
g_form.setValue("priority",2);
}
5)auto populate callers email id in email feild
Answer:-USE client script
Path:- system navigator>client script ONchange
CODE:-
var calleremail=g_form.getReferance("caller_id").email;
g_form.setvalue("u_email",calleremail);
6)All resolved incident tickets of last month will get auto closed on every 1st of the month
Answer:-USE scheduled job
Path:- system navigator>scheduled job
CODE:-
var gr=new GlideRecord("incident");
gr.addEncodedQuery("paste query of resolved incident to close");
gr.query();
while(gr.next()){
gr.state="7";
gr.work_notes="closed";
gr.close_code="";
gr.close_notes="";
gr.update();
}
7)creates button on form if the user click on form child incident will be closed
Answer:-USE UI SCRIPTS
Path:- system navigator>UI SCRIPTS
CODE:-
action name:-sys_demo
onclick function:-demo();
function demo(){
var answer=confirm("you wants to close child incident ");
if(answer==true){
gsftsubmit(null,g_form.getFormElement(),"sys_demo");
}
}
var gr=new GlideRecord("incident");
gr.addQuery("parent_incident",current.sys_id);
gr.query();
while(gr.next())
{
gr.state="7";
gr.work_note="child incident closed";
gr.close_code="";
gr.close_notes="";
gr.update();
}
action.setRedirectURL(current);
8)if the caller of the incident is VIP user then urgency shold be high and alert pop with vip user
Answer:-USE onchange client script
Path:- system navigator>client script
CODE:- when caller feild changes
var vipalert=g_form.getReferance("caller_id",vipfunction);
function vipfunction(vipalert){
if(vipalert.vip=="true"){
g_form.setVaule("urgency",1);
alert("caller of the incident is vip user");
}
}
9) when the priority of the incident changes then trigger notification to assignment group and caller that contains current priority and who changed priority?
Answer:-USE event registry,BR,notification
Path:- system navigator>event registry
CODE:-
-event registry:-
- event name-demo_priority_change
- table:-incident
- fired by:- business rule
- when to send:- event fired> select event name
- who will receive:- select users
- what it contains:-
Answer:-USE onchange client script
Path:- system navigator>client script
CODE:-
if(g_form.getvalue("state")=="102"){
g_form.setSectionDisplay("notes",false);
}
return;
Comments
Post a Comment