User ID not populating automatically when new user is created

mlamin
Giga Guru

Hello, 

 

I am working on an onboarding process where I have created my own Lifecycle Event, Record Producer, and an HR Service to trigger my Lifecycle Event. I went ahead and added my HR Service in the client include script so that my new user will be automatically created. I have my user being created but my user ID field is not being populated for some reason. I am not sure if there is somewhere in the script I need to specify that since I am not using the demo provided. Please advise how to get that populated.

1 ACCEPTED SOLUTION

Sandeep Rajput
Tera Patron
Tera Patron

@mlamin The entire implementation of the sample onboarding lifecycle event shared by ServiceNow is nothing short of quagmire. I started looking into the user id creation process and after exploring dozens of OOTB script includes like hr_CaseUtils, hr_ActivityUtils, hr_Profile, hr_ServicesUtils, finally came to know that the process of account/user generation depends on two changes.

1. Addition of hr_service value in hr_CaseUtils (This step was already done by you)

this._requiresUserOrProfileCreation = {
			'request_onboarding':'',
			'new_hire_journey':''
		};

2. Addition of Account Notification activity inside your first activity set in the lifecycle event.

Screenshot 2023-08-30 at 12.01.22 AM.png

 If you open this activity, you will find the details.

Screenshot 2023-08-30 at 12.03.37 AM.png

A workflow works on top of this HR Service which is responsible for creating the User account.Screenshot 2023-08-30 at 12.08.28 AM.pngAfter opening this workflow you would find an activity responsible for generating the login information for the new hire.

Screenshot 2023-08-30 at 12.09.52 AM.pngHere is the script include used in the process.

Screenshot 2023-08-30 at 12.10.23 AM.png 

In your case, you might not have added the Account Notification Activity with Account notification HR Service due to which the user id and profile may not be getting generated for your new hire.

 

I recommend you to add this this activity inside your first activity set in your lifecycle event.

 

Here is another good read on the same topic https://www.servicenow.com/community/hrsd-forum/hr-lifecycle-events-cases-how-user-is-created-when-s...

 

Hope this helps.

 

View solution in original post

4 REPLIES 4

Mohith Devatte
Tera Sage
Tera Sage

Hello @mlamin ,

can you please post the script that you are using ?

This is just the default script includes that ServiceNow has. I just added my HR service name to get my Lifecycle event to create my new user.

Sandeep Rajput
Tera Patron
Tera Patron

@mlamin The entire implementation of the sample onboarding lifecycle event shared by ServiceNow is nothing short of quagmire. I started looking into the user id creation process and after exploring dozens of OOTB script includes like hr_CaseUtils, hr_ActivityUtils, hr_Profile, hr_ServicesUtils, finally came to know that the process of account/user generation depends on two changes.

1. Addition of hr_service value in hr_CaseUtils (This step was already done by you)

this._requiresUserOrProfileCreation = {
			'request_onboarding':'',
			'new_hire_journey':''
		};

2. Addition of Account Notification activity inside your first activity set in the lifecycle event.

Screenshot 2023-08-30 at 12.01.22 AM.png

 If you open this activity, you will find the details.

Screenshot 2023-08-30 at 12.03.37 AM.png

A workflow works on top of this HR Service which is responsible for creating the User account.Screenshot 2023-08-30 at 12.08.28 AM.pngAfter opening this workflow you would find an activity responsible for generating the login information for the new hire.

Screenshot 2023-08-30 at 12.09.52 AM.pngHere is the script include used in the process.

Screenshot 2023-08-30 at 12.10.23 AM.png 

In your case, you might not have added the Account Notification Activity with Account notification HR Service due to which the user id and profile may not be getting generated for your new hire.

 

I recommend you to add this this activity inside your first activity set in your lifecycle event.

 

Here is another good read on the same topic https://www.servicenow.com/community/hrsd-forum/hr-lifecycle-events-cases-how-user-is-created-when-s...

 

Hope this helps.

 

Thank you! This resolved my issue.