Hi Jarred!
This is my code in python:
from psdi.mbo import MboConstants
from psdi.server import MXServer
# Obtener la instancia del servidor Maximo
mxServer = MXServer.getMXServer()
## get the username of the logged-on user
username = mbo.getUserInfo().getUserName().upper();
## get a temporary MBO set to see if the user belongs to the group and set a Boolean variable
prev_GS = False if mbo.getMboSet("$AUTH", "GROUPUSER", "groupname IN ('PREV-GS') AND userid = '" + username + "'").moveFirst() == None else True;
if prev_GS:
mbo.setValue("WORKTYPE", "GSMAN")
else:
mbo.setValueNull("WORKTYPE")
It works but always, regardless of whether or not the user belongs to the "PREV-GS" security group
Regards and thanks for your help!
------------------------------
Martin Fabra
ARSAT S.A. - Actively seeking employment
------------------------------
Original Message:
Sent: 04-18-2024 08:57
From: Jade Warren
Subject: Conditional default value
Hello Martin!
A script like the following could work:
## get the username of the logged-on user
username = mbo.getUserInfo().getUserName().upper();
## get a temporary MBO set to see if the user belongs to the group and set a Boolean variable
prev_GS = False if mbo.getMboSet("$AUTH", "GROUPUSER", "groupname IN ('PREV-GS') AND userid = '" + username + "'").moveFirst() == None else True;
if (prev_GS): mbo.setValue("WORKTYPE", "GSMAN");
else: mbo.setValueNull("WORKTYPE");
------------------------------
Jade Warren
Great River Energy
------------------------------