Create HR profile or update when user is inserted/Updated
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-19-2022 11:48 PM
Hi Community,
I have created Business rule to auto create HR profile when the user record is inserted or updated if there is no HR profile created for the user. below is the business rule .but business rule is not working Can any one let me know if there are any changes in this code?
Business rule : After create/Update no conditions added in When to run and Actions. Just Added Advanced script
Thank you.
- Labels:
-
HR Service Delivery

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-20-2022 07:59 AM
I like to share BR we are using below for your reference:
1) Create HR Profile:
(function executeRule(current, previous /*null when async*/ ) {
var userId = current.sys_id;
checkAndCreateHRProfile(userId);
function checkAndCreateHRProfile(user) {
var gr = new GlideRecord('sn_hr_core_profile');
gr.addQuery('user', user);
gr.query();
if (!gr.next()) {
gs.info('No user is found');
var hrProfile = new hr_Profile();
hrProfile.createProfileFromUser(user);
}
}
})(current, previous);
2) Update HR Profile
If my reply is Helpful/Correct, please mark the answer as correct. This will help others searching for a similar question, and will take the question off the unsolved list.
Best regards,
John
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-20-2022 02:09 PM
Hi Thanks for your response. But i was wondering if we use Flow designer for this ?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-20-2022 02:22 PM
Hi
Yes you can use a Flow for this instead of a business rule. Performance wise, a Flow probably has a little more overhead but nothing significant.
You'd want the Flow's trigger to be when the user's record is created or updated (and perhaps meets the additional condition), have it do a check (if statement logic) and then to a ServiceNow Core action to create a record.
If this answers your question, please mark the post as solved. So that others looking for something similar can find this thread.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-21-2022 08:57 AM
Yes, you can use Flow Designer, but not recommend.
The propose of Flow Designer is below, which is often used to replace the workflow with low code approach
Flow designer is introduced to configure the process flow without having any developer knowledge. Flow Designer provides a set of ServiceNow core action steps to automate Now Platform processes. It is very useful and user friendly for all ServiceNow users, even for non-technical users and management people. Reduces development cost in business.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-16-2022 09:26 AM