The Zurich release has arrived! Interested in new features and functionalities? Click here for more

Verify if user is active

Alex Kraemer
Giga Guru

Hello together


We have a UI Action in the Incident, through which a CI Owner can be informed about the Incident.

find_real_file.png

 

Subsequently, a business rule is triggered which sends the incident as a PDF to the stored CI owner.

Everything works fine, but now we need to check if the user is active. If yes, the process should run as today and if not, a message should be displayed that the user is inactive (the mail is not sent if the user is not active).

Can someone help me with the code because I can not implement this myself?

Thanks for inputs and greetings
Alex

1 ACCEPTED SOLUTION

Sorry just realised you are in UI action at server side

if(current.u_affected_service.assigned_to.active == true ||current.u_affected_service.assigned_to.active == 'true')
{
gs.eventQueue('wid.notify.ci_owner', current, current.u_affected_service.assigned_to, gs.getUserID());
gs.addInfoMessage(gs.getMessage('The CI owner of this incident will be notified'));
}
else
{
gs.addInfoMessage('User is not active');
action.setRedirectURL(current);
}

View solution in original post

8 REPLIES 8

Sorry just realised you are in UI action at server side

if(current.u_affected_service.assigned_to.active == true ||current.u_affected_service.assigned_to.active == 'true')
{
gs.eventQueue('wid.notify.ci_owner', current, current.u_affected_service.assigned_to, gs.getUserID());
gs.addInfoMessage(gs.getMessage('The CI owner of this incident will be notified'));
}
else
{
gs.addInfoMessage('User is not active');
action.setRedirectURL(current);
}

Great it works and thank you very much

Regards

Alex

Valmar Neves
Tera Contributor

Hi @Alex Kraemer ,

 

Can you add the validation if the cmdb_ci Owner is active on "UI Action condition".

 

current.cmdb_ci.owned_by.active

 

This way the action name will only be displayed if the owner is active.

Regards,

 

Hi @Valmar Neves 

Thanks for your input.

An interesting approach. From a process point of view, I prefer the other variant because we know that the user is disabled (if the button does not appear, there is confusion in the service desk).

Thanks anyway and as I said, would also be an option
Greetings
Alex