Version: 11.1.1.10427
I'm trying to use the core_v2_roleUsers.IsUserInRoles within an Automation rule but I cannot get this to work, basically the Automation is triggered on User.AfterUpdate but as soon as I try to check for a given Role we get an exception.
Here is the automation implementation javascript:
var userId = context_v2_automationTrigger.Arguments.Id; var user = core_v2_user.Get({Id: userId}); var userName1 = user.Username; var AdminRole = "Administrators"; var AdminResponse = core_v2_roleUsers.IsUserInRoles(userName1, AdminRole); core_v2_eventLog.Write("UserId:" + userId + " Username:" + userName1 + " Checking Role: " + AdminRole +" AdminResponse: " + AdminResponse + " .", { Category: "Automation" });
The idea being that I want to check and see if the user just updated belongs to Role 'Administrators', then I can perform other tasks after that check.I am writing out to the event log to check if this is working and seeing the values come across.
Am I doing something wrong?
This is what I see in Exception Log:
(An error occurred while trying to render a widget. Details of the issue were logged for review by the administrator.) ---> Telligent.Evolution.ScriptedContentFragments.Model.JavaScriptException: Line 5, Column 0: TypeError: No public methods with the specified arguments were found. at IsUserInRoles(userName1, AdminRole) @ 20:5 at call(Jint.Parser.Ast.ThisExpression) @ 0:1