
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-22-2017 02:50 AM
Hi,
for a string I can do something like this ... current.u_field1 = current.u_field1 + current.u_field2; current.update();
... but how to do this if both fields are arrays?
Thank you!
Solved! Go to Solution.
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-22-2017 04:08 AM
Have a read of this thread about why not to use current.update()
Never use current.update in a Business Rule
try the below script, it's saying, if the current watch list is not empty, get the value and add it to the work notes.
if(!current.watch_list.nil()){
var watch = current.getValue('watch_list');
current.work_notes_list += ',' + watch;
}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-22-2017 04:18 AM
I know regarding the BR and the current.update() ... was just stupid for a moment .... BUT I found 2 OOB BR that have current.update() within before BR 😉
Opened a HI already to have a look ...
Back to the issue ... still not working.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-22-2017 05:32 AM
I tested that on my dev instance and it works just fine.
Are you on the incident table or a scoped app and are both the glide list fields you're working with on the same form?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-22-2017 05:52 AM
I'm on a custom table (but global), records are same .. so it should work.
The BR also does what it should do ... except this.
When I just add a single value to u_field2 and have u_field1 empty .. this works: current.u_field1 = current.u_field2;
This tells me that something is wrong with the code ... ;-(

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-22-2017 05:55 AM
Stopp. Shit. It worked before as the current.update was there ... no it doesn't either ... there is something wrong.
Need to check again ... . So I hope your code is ok .. will update if I find the issue.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-22-2017 06:00 AM
test with 1 value in each field and try:
current.u_field1 += current.u_field2;
When i tried this it just added the 2 sys_id's together hence why i went for the below as glide lists are just a comma separated list of values.
current.u_field1 += ',' current.u_field2
Stick in some gs.logs to tell you what's happening:
var field = current.u_field1.getValue();
var field2 = current.u_field2.getValue();
gs.log('this is the value: ' + field);
gs.log('this is the other value: ' + field2);
current.u_field2 += ',' + field;
gs.log('this is the new value: ' + field2;
Good luck with it and Merry Christmas, i'm off home for the holidays