var x = new GlideMultipleUpdate('sys_user');
x.addQuery('company', "59a8f78c37561304985d8ff1b3990e2f");
x.setValue('company', "d4287b0c37561304985d8ff1b3990e92");
x.setValue('department', null);
x.execute();
OOTB there is a relationship between a task and a workflow activity creating the task. This is a reference to the activity instance. Note, it is inactive in dictionary, thus it can't be selected in filter builder etc. Although, this fact brings extra (unwanted) food for thoughts.
Additionally, wf_activity is a reference to workflow activity instance. Instance of activity which is used in the workflow. Be careful here, if you tie a rule based on activity id, you'll get it changed after the workflow version is changed.
It ends up with system (internal) results only e.g. success if activity was successful. Return activity sets a parent workflow scratchpad. An extra activity is required to analyze the result of the subflow execution.
Pattern: I'd like something to happen in future.
It's a subset of the patter I'd like some event to happen in future. It covers the case of conditional execution: event + script action.
In the sample below I'd like to send reminder email (of course, if it is still valid).
var x = new ScheduleOnce();
x.setDocument(current);
x.setLabel("Approval reminder " + current.getDisplayValue());
x.setTime(/*now + 4 days*/);
Watch out performance of your queries!
var sw = new GlideStopWatch();
var recGR = new GlideRecord('cmdb_ci');
recGR.addQuery('sys_class_name', 'INSTANCEOF', 'cmdb_ci_server');
recGR.addQuery('name', 'ABCDEF');
recGR.setLimit(1);
recGR.query();
if (recGR.hasNext()) {
I used to believe my operations are successful. Well, it's not a bullet proof.
var x = new GlideRecord('incident');
var sys_id = x.insert();
sys_id;
// GUID
x.isActionAborted()
well, there is a nice book, listing many Jelly features. Although, I don't know if it is mentioned there
Goal - validate form field values Alert message is get using 1 phase JAXL expression, JS: - prefix
function validateForm() {
if (gel('first_name').value == '') {
alert("${JS:gs.getMessage('Please input First Name')}");
return false;
Thread-Topic is a header of email message, it contains the original subject of the conversation
var headers = email.headers + "";
var topic_regex = /Thread-Topic:(.*)/i;
var topic_match = topic_regex.exec(headers);
var topic = (topic_match && topic_match[1]) ? topic_match[1] : email.subject;
There is a class GlideController. It's not documented. However you have definitly come across it. In client-callable script include, for example. Or in OOTB code :)
class
close
enforceSecurity
enforcingSecurity
equals
evaluate
evaluateAsObject
evaluateGeneratedString
Collection of methods to get URL to a record.
/*
Use GlideSubstituteURL class
.generateURL(GlideRecord, Record ID)
*/
var gr = new GlideRecord('sys_user');
gr.get(gs.getUserID());