Reactivate User in HR Agent Workspace: HR Profile

Brian Shacklefo
Tera Contributor

I am attempting to add the Reactivate User UI button to HR Agent Workspace: HR Profile. I am able to get the button to display, but I am having trouble getting it to actually do anything. I have tried several entries in Workspace Client Script on the Workspace tab in the UI Action.

 

Here is what I currently have:

function onClick() {
    var react = g_form.getActionName(reactivateUser);
    g_form.submit(react);
}  
 
I also tried:
function onClick() {
 
}
 
Nothing I have tried so far seems to be allowing the UI button to call the Script Action: Reactivate Sys User.
Please advise.
Sincerely,
Brian Shackleford
1 ACCEPTED SOLUTION

@Brian Shacklefo , Thank you for reaching out.

 

Please see if below helps.

 

ahefaz1_0-1704761328379.png

 

ahefaz1_1-1704761355297.png

 

Server Script

 

 

var grUser = new GlideRecord('sys_user');
grUser.get(current.getValue('user'));
grUser.setValue('active', true);
grUser.update();
current.setValue('sys_updated_by' , gs.getUserName());
current.update();
action.setRedirectURL(current);

 

 

Condition

 

 

!current.user.active && gs.hasRole("sn_hr_core.profile_writer")

 

 

While testing on the workspace there was an issue. Lines 5 and 6 are used to fix that.

There are other ways, but more cumbersome.

 

Please accept the solution if it resolved your query, or mark helpful if this helped.

 

Thanks,

 

View solution in original post

6 REPLIES 6

ahefaz1
Mega Sage

@Brian Shacklefo ,

 

Were you able to resolve the issue? or are still looking for a solution?

 

Thanks,

I still have not been able to resolve this yet.

Brian Shacklefo
Tera Contributor

@ahefaz1 

I still have not found a resolution to this issue yet.

@Brian Shacklefo , Thank you for reaching out.

 

Please see if below helps.

 

ahefaz1_0-1704761328379.png

 

ahefaz1_1-1704761355297.png

 

Server Script

 

 

var grUser = new GlideRecord('sys_user');
grUser.get(current.getValue('user'));
grUser.setValue('active', true);
grUser.update();
current.setValue('sys_updated_by' , gs.getUserName());
current.update();
action.setRedirectURL(current);

 

 

Condition

 

 

!current.user.active && gs.hasRole("sn_hr_core.profile_writer")

 

 

While testing on the workspace there was an issue. Lines 5 and 6 are used to fix that.

There are other ways, but more cumbersome.

 

Please accept the solution if it resolved your query, or mark helpful if this helped.

 

Thanks,