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
| function GrpMem(group_name){ | |
| //This arrary will hold the user id of the group members | |
| var arrUsers = []; | |
| //Need to lookup user id later | |
| var usr = new GlideRecord('sys_user'); | |
| //Need to get sys_id of the group | |
| var grpSysId = cmGetSysID(group_name,'sys_user_group'); | |
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
| <j:jelly trim="false" xmlns:j="jelly:core" xmlns:g="glide" xmlns:j2="null" xmlns:g2="null"> | |
| <g2:evaluate var="jvar_stamp"> | |
| var gr = new GlideRecord('sys_ui_script'); | |
| gr.orderByDesc('sys_updated_on'); | |
| gr.query(); | |
| gr.next(); | |
| gr.getValue('sys_updated_on'); | |
| </g2:evaluate> | |
| <g:requires name="angularjs.min.1.3.2.jsdbx" params="cache=$[jvar_stamp]" /> | |
| </j:jelly> |
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
| <?xml version="1.0" encoding="utf-8" ?> | |
| <j:jelly trim="false" xmlns:j="jelly:core" xmlns:g="glide" xmlns:j2="null" xmlns:g2="null"> | |
| <g2:evaluate var="jvar_stamp"> | |
| var gr = new GlideRecord('sys_ui_script'); | |
| gr.orderByDesc('sys_updated_on'); | |
| gr.query(); | |
| gr.next(); | |
| gr.getValue('sys_updated_on'); | |
| </g2:evaluate> |
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
| #Note: Rember the commands are executed LOCALY on the MID server | |
| #Note: The MID server has the same rights as the Service Account Running it. | |
| #Note: The Service Accounts rights can be used to execute commands on remote hosts, if configured to do so | |
| #Note: You may need to use different accounts to do what you need: | |
| #Note: To execute on a remote windows host with a different account: | |
| #Note: You need to rely on a PowerShell Commands which support -ComputerName & -Credential | |
| #Note: Or you need to rap you script in the PowerShell Invoke-Command | |
| #Test-WSMan -ComputerName $computer; #This works used to test remote connection | |
| #Invoke-Command -ComputerName $computer -credential $cred -ScriptBlock {net localgroup administrators}; #This works | |
| #Invoke-Command -ComputerName $computer -credential $cred -ScriptBlock {[Environment]::UserName;}; #This works |
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
| //pick_asmt, new_exp_date, new_due_date, new_sys_crt_date, new_state -- Variable Set | |
| //asmt_assessment_instance --> expiration_date | |
| //asmt_assessment_instance --> due_date | |
| //asmt_assessment_instance --> number | |
| //asmt_assessment_instance --> sys_created_on | |
| //asmt_assessment_instance --> state | |
| //gs.log("CM***: " + producer.pick_asmt + " " + producer.new_exp_date); | |
| gr = new GlideRecord("asmt_assessment_instance"); | |
| gr.get(producer.pick_asmt); |
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
| //pick_asmt, new_exp_date, new_due_date, new_sys_crt_date, new_state -- Variable Set | |
| //asmt_assessment_instance --> expiration_date | |
| //asmt_assessment_instance --> due_date | |
| //asmt_assessment_instance --> number | |
| //asmt_assessment_instance --> sys_created_on | |
| //asmt_assessment_instance --> state | |
| //gs.log("CM***: " + producer.pick_asmt + " " + producer.new_exp_date); | |
| gr = new GlideRecord("asmt_assessment_instance"); | |
| gr.get(producer.pick_asmt); |
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 |
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
| // remove demo data CIs | |
| var recCI = new GlideRecord('cmdb_ci') | |
| recCI.addEncodedQuery("sys_created_on<javascript:gs.dateGenerate('2013-09-01','00:00:00')^sys_class_name!=cmdb_ci_snc_component^ORsys_class_name=NULL") | |
| recCI.orderByDesc('sys_created_on') | |
| recCI.query() | |
| var logmsg = "Log Output\nRecords Found: " + recCI.getRowCount() + "\n"; | |
| while(recCI.next()){ | |
| var taskCI = new GlideRecord('task_ci'); |
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
| //To-Do: | |
| //Check for instance to make this varable (i.e. test, dev,etc) gs.getProperty('instance_name'); | |
| //Should groups be an array? | |
| //Should the user be an object? username,[alloud instance], [groups] | |
| var groupName = "ServiceNow Impersonation"; | |
| var users = []; | |
| var gl = new GSLog("com.glide.schedules.log.level", "cm_test"); | |
| gl.logDebug("cm_test : This is a debug message"); |
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
| // POST /api/auclg/v1/si/security_incidents | |
| // Content-Type application/json Accept application/json | |
| (function process(/*RESTAPIRequest*/ request, /*RESTAPIResponse*/ response) { | |
| //Creat Security Incident | |
| var caller; |