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

Prasad Pagar
Mega Sage

Hi @Alex Kraemer 

You want to check if Affected Service Assigned to is Active?

If yes then your script simply do below

if(current.u_affected_service.assigned_to.active == true ||current.u_affected_service.assigned_to.active == 'true')

{

gs.eventQueue... //Add code here

}

else

{

alert('User is not active');

return false;

action.setRedirectURL(current);

}

Hope this helps

Thank you
Prasad

Hi @Prasad Pagar 

Thanks for your code and the script is looking now like this:

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

{

alert('User is not active');

return false;

action.setRedirectURL(current);
}

Unfortunately there is still a parsing error at the "return" (outside of function).

Thanks again for your support
Regards Alex

Hi

Try this sir

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
{
alert('User is not active');
action.setRedirectURL(current);
}

Thank you and we are approaching the finish line.
The mail is no longer sent but the message does not appear and I end up on the Incident list view.

Regards

Alex