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
Original Message:
Sent: 04-17-2024 19:54
From: Martin Fabra
Subject: Conditional default value
Hi to all!
I want to do something in Maximo that seemed simple and I've gotten stuck, although I admit it's the first time I've tried it.
In the Preventive Maintenance application, for the worktype field (PM.WORKTYPE) I want to setup a conditional default value.
If the loggedin user is from the PREV-GS security group, the WORKTYPE value in PM application must be 'GSMAN'. If the user is from another security group, it must be null.
And I went around and couldn't move forward. I arrived at an automation script, but I don't know how to consult from there the security groups to which the user belongs.
What I'm looking for is a solution, whatever it may be.
Has anyone ever analyzed the APPFIELDDEFAULTS table? How can I register data here? I did it from the database, rebooted the system but it didn't do what I need (it didn't do anything).
I use 7.6.1.2.
Regards!
#Customizations
------------------------------
Martin Fabra
ARSAT S.A. - Actively seeking employment
------------------------------