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
| // NOT FINISHED! | |
| //getDate_rfc2822(); | |
| //var cmhash = preHash(getDate_rfc2822(),'GET','api-xxxxxxxx.duosecurity.com','/accounts/v1/account/list','username=root'); | |
| //gs.log(hashIt('fkey',cmhash)); | |
| checkDuo(); | |
| function getDate_rfc2822(){ | |
| //Raw: 2014-03-02 01:28:51 |
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
| var cm_resp = Class.create(); | |
| cm_resp.prototype = { | |
| ctest: function(){ | |
| return "something"; | |
| }, | |
| ntest: function(){ | |
| var parser = new JSONParser(); | |
| var somejson = {"myobj":1234}; | |
| return parser.parse(somejson); | |
| }, |
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
| //***** CM 5/14/2014 ***** | |
| //Find the missing departments. When a dept is closed in PeopleSoft it does not show up in the Oracle DB View | |
| //http://wiki.servicenow.com/?title=Transform_Map_Scripts | |
| //Find the sys_id of the iSetNum you are working with | |
| //'import_set' is an object that holds information about the import set your working with. | |
| var isetNum = getSysId (import_set.number,'sys_import_set'); | |
| gs.log("isetNum: " + isetNum + " Table: " + import_set.table_name); | |
| var grImp = new GlideRecord(import_set.table_name); //To look for missing depts | |
| var ccount = 0; |
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
| _getLastWeek: function(){ | |
| /*CM 22-feb-2014*/ | |
| var sevenDaysMilliSeconds = 604800000; | |
| var objLastWeek = new GlideDateTime(this.weekStart + ' 00:00:00'); | |
| objLastWeek.subtract(sevenDaysMilliSeconds); | |
| return objLastWeek.getValue().split(" ")[0]; | |
| }, |
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
| var created = new GlideDateTime(); //now | |
| var dtUtil = new DateTimeUtils(); //Helper class | |
| var firstDay = gs.getProperty("com.snc.time_card.start_day", 7); //default to Sunday | |
| var cardStart = dtUtil.getWeekStart(created, firstDay).getDisplayValue(); //GlideDate | |
| gs.log("CARDSTART This week: " + cardStart); | |
| gs.log("CARDSTART Last week: " + getLastWeek(cardStart)); | |
| function getLastWeek(currentWeek){ | |
| gs.log("I'v been called with: " + currentWeek); |
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
| //cm 5/21/2014 | |
| //Find the people who don't report time! and summarize the people who do... | |
| //u_time_card_summary: u_total_hours,u_week_starts_on,u_user | |
| //We are going to need time card | |
| var tc = new GlideRecord('time_card'); | |
| //We are going to need time card summary | |
| var tcs = new GlideRecord('u_time_card_summary'); | |
| //Get sys_id for Role of ITIL |
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
| var CMHelper = Class.create(); | |
| CMHelper.prototype = { | |
| initialize: function() { | |
| }, | |
| getStartOfWeek: function(){ | |
| var created = new GlideDateTime(); //now | |
| var dtUtil = new DateTimeUtils(); //Helper class | |
| var firstDay = gs.getProperty("com.snc.time_card.start_day", 7); //default to Sunday | |
| var startOfWeek = dtUtil.getWeekStart(created, firstDay).getDisplayValue(); //GlideDate | |
| return startOfWeek; |
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
| //Used for testing | |
| cmUnitTest(); | |
| function cmUnitTest(){ | |
| var cm = new CMHelper(); | |
| gs.log("This week: " + cm.getStartOfWeek()); | |
| gs.log("Last Week: " + cm.getSevenDaysAgo(cm.getStartOfWeek())); |
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
| //If change to a 3 page else if it's a 3 and reassigned | |
| if ((current.priority.changesTo('3')) ) { | |
| gs.log("Changesto"); | |
| true; | |
| }else if( (current.priority == '3') && current.assignment_group.changes() ){ | |
| gs.log("3andGroupChane"); | |
| true; | |
| }else{ |
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"> | |
| <script> | |
| document.writeln("Prototype.Version: " + Prototype.Version + "<br />"); | |
| document.writeln("Lets look at Global in ServiceNow: <br />"); | |
| myGlobal = this; |