Find your people. Pick a challenge. Ship something real. The CreatorCon Hackathon is coming to the Community Pavilion for one epic night. Every skill level, every role welcome. Join us on May 5th and learn more here.

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 ACCEPTED SOLUTION

fknell
Tera 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

View solution in original post

1 REPLY 1

fknell
Tera 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