How to delete HR profiles in ServiceNow

gowdash
Mega Guru

Dear Experts,

We have recently implemented the HRSD application in our instance. All the active user profiles have been converted in the HR profiles, of late we decided to remove contractors and other users from HR Profiles as they are not relevant. I know we can hard delete the profiles but it is very time-consuming.

Is there a way to remove the HR Profiles?

Best Regards,

Gowdash

2 REPLIES 2

Namrata Khabale
Giga Guru

Hey gowdash,

 

Make a scheduled job and delete those records.

Otherwise,

if you will do this by background script then system will not take that much load and can't able to delete those records instantly as number of records is very high.

So, go with scheduled job.

 

Just a sample:

//Set query as per your requirement

var gr = new GlideRecord('sn_hr_core_profile');
gr.addQuery('sys_created_on', '>', "25-08-2020" );

gr.query();
gs.info("Returned Record" + gr.getRowCount());

gr.deleteMultiple();

 

Mark Correct and Helpful, if it helps!

Best Regards,

Namrata.

 

Namrata Khabale
Giga Guru

Hey gowdash,

Is your issue get resolved or do you require further information regarding this?

If so, Kindly mark my answer correct and helpful on the basis of impact!

 

Best Regards,

Namrata.