Update systemusername and email when there is a change in Firstname, Lastname

jdoma
Regular Contributor
Regular Contributor

Can anyone helps me to find a solution to rerun systemusername and email generation rules while User Update when there is a change in Firstname and/or Lastname. Am trying to use Generate User Email action from User Update rule but that is not generating any email for User.

6 REPLIES 6

ManishAcharya
Saviynt Employee
Saviynt Employee

There is no logic as such available which can rerun systemusername generation rule. You can write custom code which will have the logic to generate them again and update user using the API. Then this jar can be attached to custom action in user update rule.

jdoma
Regular Contributor
Regular Contributor

Thank you Manish for the time and response. If you have a sample code/doc on how to invoke the custom jar, please provide us. Am not getting even if I generate a systemusername using custom method, we need to perform the uniqueness check as well.

You need to use saviynt rest api to check if systemusername is already used or not 

https://documenter.getpostman.com/view/1797923/RWaLwo21?version=latest#ef353ccb-a040-4324-bd9f-de90f... 

Hello @jdoma,

You can have a user update Rule to check for FirstName or LastName update, and the action of rule would be a "Custom Action". 

You will have to provide a fully qualified classname and the method name to this Action

avinashchhetri_0-1666370584219.png

You will need to write a custom extension (jar). The output of this custom Action is a JSON  (String userJson) of the user which triggered this rule. You would need to parse the userJson and get the relevant information, for e.g. UserName, SystemUserName, FirstName,  LastName and whatever attributes you need.

You can then have your custom logic to generate a systemUserName validate it's uniqueness until you get a unique value.

Sample API call to check the uniqueness of the systemUserName

avinashchhetri_1-1666371409672.png

 

Once you have the unique systemUserName generated, you can use the updateUser API to update the systemUserName.

Sample API Call :

avinashchhetri_2-1666371610422.png

 

Once the systemUserName is updated, you can have another user update rule to propagate the changes to other downstream applications, if needed.

 

 

 

Regards,
Avinash Chhetri

Hello Avinash,

Could you please share any documentation link that how to do custom action external jar development such as interface to be implemented, method need to be implemented, how to upload to Saviynt and make of use it? 

I can see we can have custom action at workflow, user update rule and scheduled job custom external jar execution, but not sure how to start... if you could have a step by step instruction start from custom class development > jar packaging > upload to Saviynt > use it in workflow > use it in user update rule > use it in scheduled job, it would be great.

Thank you very much!