...
Code Block |
---|
var incidents = ["INC0145723","INC0145726","INC0145736","INC0145721","INC0145718","INC0145729","INC0145722","INC0145727","INC0145716","INC0145711"]; var state = '3'; for (i=0; i<incidents.length; i++) { var gr = new GlideRecord('incident'); gr.addQuery('number',incidents[i]); gr.query(); if(gr.next()) { gs.print("old state = " + gr.incident_state); gr.incident_state = state; gr.update(); } } |
Lou often gives us lists of change fields
Here's how to make them better with bash. This still needs some work, but is better than nothing:
Code Block |
---|
[db692@mas013-new ~]$ cat asdf
CHG0006629
CHG0004449
# the next line is for gnu sed
[db692@mas013-new ~]$ echo -n "var changes = [\""; cat asdf | sed ':a;N;$!ba;s/\n/","/g'
var changes = ["CHG0006629","CHG0004449
# here's one for MAC (BSD) sed
zuse:~ db692$ echo -n "var incidents = [\""; cat jkl | sed -e ':a' -e 'N' -e '$!ba' -e 's/\n/'\",\"'/g'
var incidents = ["INC0145723","INC0145726","INC0145736","INC0145721","INC0145718","INC0145729","INC0145722","INC0145727","INC0145716","INC0145711
|