and more in a single search tool across platforms. Read the announcement here. |
05/08/2023 06:03 AM
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);
Solved! Go to Solution.
05/09/2023 01:42 AM
Yes the userJSON has complete user attributes for the particular user for which the rule got triggered.
05/09/2023 02:59 AM
@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?
05/09/2023 03:21 AM
Can you check if custom action is getting triggered when user is created from import.
05/10/2023 12:16 AM
yeah when I am creating the User from API then it's working. Can you tell me what's the reason behind it.
06/08/2023 09:18 AM
Because your rule must have a config trigger when user is created from api.