August 1, 2012

Detect if an MBO method has been invoked by an user session or by a background process

You are in the middle of a Mbo class and you have to perform some logic only if your piece of code is invoked by a user sitting in front of of Maximo UI.
How would you understand if the Mbo method has been invoked by an interactive user session or by a background process like an escalation, crontask or MIF?
Here is a Java snippet to retrieve this information.

boolean isInteractive = getUserInfo().isInteractive();

Just put it in your Java method and use the isIntercative flag as you want.

2 comments:

  1. Hi Bruno,

    I'm trying to use it in automation script. First question, can it be used using jython ?
    Second question, if yes, I have written script where I want to send automatic notification if the data is being modified by Integration and not by any user.
    But it is not sending mail. I put condition like
    if(isInteractive=='N'):
    send the mail.
    But it is not going inside the if means it is taking it as Y.
    Can you please help me with this.

    Thank You.

    ReplyDelete
  2. I got it. I did like
    if not(isInteractive):
    send mail.
    isInteractive gives True or False.

    Thanks for informative blogs.

    ReplyDelete