How can an agent manage HR templates?

miro2
Mega Sage

Hi,

I found out that HR agents must have the sn_hr_le.activity_writer role if they want to access and edit HR templates. I found an ACL in the HR Core scope that says that if a user has the above role and the owning group field is not empty, they are able to edit HR templates.

I'm wondering about is that this role comes from the LE scope, and I don't see a similar role in the HR Core scope.

What do you think? Is it the right way to give HR agents the sn_hr_le.activity_writer role to edit hr templates or should I consider another approach?


ACL

miro2_0-1705667751795.png


canEditTemplate function

 

 

canEditTemplate: function(template) {
		var roles = new hr_Utils();
		// if a life cycle admin, can edit regardless of owning group
		var isHrAdmin = roles.checkUserHasRole('sn_hr_core.admin');
		if (isHrAdmin)
			return true;
		
		// if not an activity writer, then cannot edit, regardless of owning group
		var isActivityWriter = roles.checkUserHasRole('sn_hr_le.activity_writer');
		if (!isActivityWriter)
			return false;
		
		// has activity writer, but must be in group too
		if (template.owning_group) {
			var grGroups = new GlideRecord('sys_user_grmember');
			grGroups.addQuery('user', gs.getUserID());
			grGroups.addQuery('group', template.getValue('owning_group'));
			grGroups.query();
			var isMemberOf = grGroups.next();
			return isMemberOf;
		} 
		
		return template.isNewRecord();
	},

 

 

 

Manage HR Template module - when users have above role, they can see this module

miro2_1-1705667859868.png

 

1 REPLY 1

Ahana 01
Tera Expert


To manage HR templates in ServiceNow, an agent can follow these steps:

1. Navigate to HR Template Management: From the ServiceNow dashboard, go to "HR Service Management" > "Administration" > "HR Template Management".

2. Create a New Template: Click on "New" to create a new HR template. Fill in the necessary details such as name, description, and category.

3. Define Template Fields: In the "Fields" section, define the fields that should be included in the template. These fields can be standard or custom fields.

4. Set Access Controls: In the "Access Controls" section, define who can view and edit the template. You can specify roles, groups, or specific users.

5. Save the Template: Click on "Submit" to save the template. It will now be available for use in HR cases.

6. Edit Existing Templates: To edit an existing template, navigate to the list of templates, select the one you want to edit, make the necessary changes, and click "Update".

7. Delete Templates: To delete a template, select it from the list, and click "Delete".

Remember, only users with the "sn_hr_core.admin" role can manage HR templates.

For a good and optimistic result, and solving ServiceNow-related issues please visit this website.https://nowkb.com/home
Kindly mark correct and helpful if applicable