Thursday, 17 September 2020

Get PersonID of the Logged in User in Automation Script | Maximo

There are multiple ways  to get the person id in Automation script, one of the them is as below:

PersonSet = MXServer.getMXServer().getMboSet("MAXUSER", mbo.getUserInfo())

    PersonSet.setWhere("PERSONID=:&PERSONID&")

    vPerson = PersonSet.getMbo(0)

    service.error(user,vPerson.getString("personid"))

    PersonSet.save()

 

For Person ID: -                 :&PERSONID&

For Username  -                   :&USERNAME&

 

or we can also use the one of the implicit variable ( USER )fo the logged in user:

PersonSet = MXServer.getMXServer().getMboSet("MAXUSER", mbo.getUserInfo())

    PersonSet.setWhere("userID='" + user + "'");

    vPerson = PersonSet.getMbo(0)

    service.error(user,vPerson.getString("personid"))

    PersonSet.save()

No comments:

Post a Comment