Created
May 27, 2015 18:06
-
-
Save cmcdevitt/e30fb288a4c45f35f5f5 to your computer and use it in GitHub Desktop.
Route Incident Record Producer based on a Schedule
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //redirect to thank you page after submit | |
| producer.redirect = "/ess/help_thank_you.do"; | |
| current.contact_type = 'Self-service'; | |
| var user = new GlideRecord('sys_user'); | |
| user.addQuery('sys_id','=', current.caller_id); | |
| user.query(); | |
| if(user.next()) | |
| { //seting Incident location and phone number from the user record | |
| current.location = user.location; | |
| current.u_contact_phone = user.phone; | |
| } | |
| //You can set a display value in a reference field like this: | |
| //target.assignment_group.setDisplayValue('Service Desk'); | |
| if (producer.u_incident_ess_category == "I3") | |
| { | |
| current.cmdb_ci = "255e4732891f250057b1c6f6a18158c4"; | |
| current.assignment_group.setDisplayValue('Call Center Operations'); | |
| current.category = producer.u_incident_ess_category; | |
| current.subcategory = producer.u_incident_ess_sub_category; | |
| } | |
| else | |
| { | |
| var asg = ''; //'Service Desk' | |
| var g = new GlideRecord('cmn_schedule'); | |
| g.addQuery('name', 'ServiceDesk'); | |
| g.query(); | |
| if (g.next()) { | |
| var sched = new GlideSchedule(g.sys_id); | |
| var gdt = new GlideDateTime(); | |
| gdt.setDisplayValue(gs.nowDateTime()); | |
| if (sched.isInSchedule(gdt)){ | |
| //gs.info("CM:Is in the schedule"); | |
| //I.E. This should be business hours | |
| asg = 'Application Service Desk'; | |
| }else{ | |
| //gs.info("CM:Is NOT in the schedule"); | |
| //I.E. This should be NON Business Hours | |
| asg = 'Service Desk'; | |
| } | |
| } | |
| //This where it should resolve to | |
| current.assignment_group.setDisplayValue(asg); | |
| } | |
| //current.short_description = short_description; | |
| //current.insert(); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment