getUserByID not recognized in Business Rule

tahnalos
Kilo Sage

Previously we had a piece of code in a business rule that checked for the user that did the update on a record.  This code did work but we have discovered that it is currently no longer working and would like alternatives to this issue.

Here is the log that shows the issue:

com.glide.script.RhinoEcmaError: Cannot find function getUserByID in object com.glide.script.fencing.ScopedUser@4c0d4e96.
sys_script.dc9d9d3233aabad038f08ac13d5c7b6f.script : Line(4) column(0)
1: (function executeRule(current, previous /*null when async*/ )
2: {
3: gs.addInfoMessage ('test 0');
==> 4: var upd_user = gs.getUser().getUserByID (current.sys_updated_by);
5: var new_comment = current.comments.getJournalEntry(1).match(/\n.+/gm).join("\n");

From what I gather, the getUserByID method is no longer recognized so wondering what alternatives I can use.

1 REPLY 1

fknell
Kilo Patron

Hi @tahnalos,

you're in a scoped app and therefore the restricted user object doesn't expose getUserByID(). 

 

For your reference the API doc for GlideUser:

- API Reference - Server Global 

API Reference - Server Scoped  

 

An alternative might be using the GlideRecord object instead.

 

Hope this helps