GlideScopedEvaluator not working

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-17-2017 04:13 AM
We have added an Attribute field to the sys_user table. It is a GlideList field that points at a table of attributes and the condition that causes them to be added to the user. We do this to make reporting reasons. Recently we have had the need to update the user record in certain ways when certain attributes are added to a user record. I have been experimenting with ways to go about this and wanted to use a script field. So I have been testing out how to use the GlideScopedEvaluator by running it as a background script in a sub prod instance and it does not seam to be working. Below is the test code and the results.
Any thoughts would be appreciated.
var g = new GlideScopedEvaluator();
var s = new GlideRecord("sys_script");
s.initialize();
s.setValue("script", "gr.setValue('locked_out', false);");
gs.print(s.getValue("script"));
var u = new GlideRecord("sys_user");
u.get("30e473300a0a3c5401d64c7b0a5dc988");
gs.print(u.getValue("locked_out"));
g.putVariable("gr", u);
g.evaluateScript(s, 'script', null);
u = g.getVariable("gr");
gs.print(u.getValue("locked_out"));
eval("u.setValue('locked_out', false);");
gs.print("After Eval used: " + u.getValue("locked_out"));
Output
*** Script: gr.setValue('locked_out', false);
*** Script: 1
*** Script: 1
*** Script: After Eval used: 0

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-23-2017 04:18 AM
Has a defect or enhancement been opened to address this issue? It would also be nice if it was more clear on how to pass in a GlideRecord that will be updated and passed out.