Skip to content

Commit 81ef846

Browse files
authored
Merge branch 'ServiceNowDevProgram:main' into main
2 parents 3f83b05 + 95ddb7d commit 81ef846

File tree

4 files changed

+58
-0
lines changed

4 files changed

+58
-0
lines changed
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
Copy work notes to parent
2+
Checks if work notes have changed in the current record.
3+
If yes, it copies the latest journal entry to the parent’s work notes.
4+
Sets the updated flag to true.
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
/Copy work notes to parent
2+
/* Checks if work notes have changed in the current record.
3+
If yes, it copies the latest journal entry to the parent’s work notes.
4+
Sets the updated flag to true.*//
5+
(function executeRule(current, previous) {
6+
if (!current.parent) return;
7+
8+
var parent = current.parent.getRefRecord();
9+
if (!parent.isValidRecord()) return;
10+
11+
var updated = false;
12+
13+
14+
if (current.work_notes.changes()) {
15+
parent.work_notes = current.work_notes.getJournalEntry(1);
16+
updated = true;
17+
}
18+
19+
if (updated) {
20+
parent.update();
21+
}
22+
})(current, previous);
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
This Script Include is useful for:
2+
3+
Filtering user records based on field from table data.
4+
Populating reference fields or dropdowns dynamically via GlideAjax.
5+
Client-side filtering based on server-side data logic.
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
/*This Script Include is useful for:
2+
3+
Filtering user records based on field from table data.
4+
Populating reference fields or dropdowns dynamically via GlideAjax.
5+
Client-side filtering based on server-side data logic.*/
6+
7+
var <Script_include_name> = Class.create();
8+
<Script_include_name>.prototype = Object.extendsObject(global.AbstractAjaxProcessor, {
9+
<functionname>: function() {
10+
var validID = [];
11+
var gr = new GlideAggregate("<table_name>");
12+
gr.addQuery("field","value");
13+
gr.addAggregate("COUNT");
14+
gr.groupBy("fieldname");
15+
gr.query();
16+
while (gr.next()) {
17+
var id = gr.getValue("fieldname");
18+
19+
validID.push(id);
20+
21+
}
22+
23+
var varname = "user_nameIN" + validID;
24+
return varname;
25+
},
26+
type: '<Script_include_name>'
27+
});

0 commit comments

Comments
 (0)