Announcing the SAVIYNT KNOWLEDGE EXCHANGE unifying the Saviynt forums, documentation, training, and more in a single search tool across platforms. Click HERE to read the Announcement.

UserJSON parameter in Custom Method (CustomJar) in User Update Rule.

gaurav007
New Contributor II
New Contributor II

Hello,

The usecase we have is that when ever a user is created from UI, the Custom Action JAR should be executed. but the thing is when ever we create a user there's no way to check if the JAR is getting executed or not. we need to know a few things. 

- When Custom Action JAR is triggered/executed through a User Update Rule for a newly created user does the UserJSON parameter have the required/expected value?

- When we tried passing the hard coded value for UserJSON (as in the below code) JAR got executed and the functionality worked as expected for that user.(as - userJson="{\"username\":\"gc123\",\"firstname\":\"Rohit\",\"lastname\":\"Raj\",\"email\":\"r.rohit@inspira.com\"}";)

Below is the code for reference(without the hardcoded value)- 

public void CustomMethod(String userJson) {

String firstname = null;
String lastname=null;
String Searchemail=null;
String accessToken = null;
String username = null;
GsonBuilder builder = new GsonBuilder();
Gson gson = builder.create();
User userData = (User)gson.fromJson(userJson, User.class);
try {
firstname=userData.getFirstname();
lastname=userData.getLastname();
Searchemail=userData.getEmail();
username=userData.getUsername();
System.out.println("userJson data : " + userData);

5 REPLIES 5

nimitdave
Saviynt Employee
Saviynt Employee

Yes the userJSON has complete user attributes for the particular user for which the rule got triggered.

gaurav007
New Contributor II
New Contributor II

@nimitdave , The thing is when we use the same JAR with user update rule (trigger when user is updated from UI) is works perfectly fine as expected.

But when we use the User Update Rule (trigger when User is created from UI) I don't think that the rule is triggering the Custom Action JAR(custom methods), because we tried it with loggers it did not print anything (note that the same loggers printed expected results when user is updated through UI). So we need to know that if Custom Action JAR will/should get triggered through User Update Rule after the User is created? 

nimitdave
Saviynt Employee
Saviynt Employee

Can you check if custom action is getting triggered when user is created from import.

gaurav007
New Contributor II
New Contributor II

yeah when I am creating the User from API then it's working. Can you tell me what's the reason behind it.

nimitdave
Saviynt Employee
Saviynt Employee

Because your rule must have a config trigger when user is created from api.

nimitdave_0-1686241075613.png