Any time you want to require something, I typically recommend things done at a MBO level (global data restriction typically) over application level restrictions. I imagine you want this to apply to all applications where someone could change the status for example. Most people think about WOTRACK, but QUICKREP is another option out of the box and someone may have cloned those apps or you may have industry solutions/add-ons with their own version and you probably want to require it in all of them, which global data restriction is good at handling. Not to mention that conditional UI is a pain (since you only want to require it when the status is CAN).
For this particular situation, you can't use a global data restriction due to an issue with how the framework validates the data restrictions (I think it's a bug, so I may open a PMR for it, but I noticed it in our 220.127.116.11 & 18.104.22.168 demo apps in trying to confirm it would work). So I would make it an attribute launch point automation script on WOCHANGESTATUS on the STATUS attribute. With a simple python script like below, it will be required. No screen changes and you can build out any logic you need should you require it for other status changes (for example, this looks for literal status='CAN', but you may have synonyms of that status)if mbo.getString("STATUS")=="CAN": mbo.getMboValue("MEMO").setRequired(True)
from psdi.mbo import MboConstants
from psdi.server import MXServer
if MXServer.getMXServer().getMaximoDD().getTranslator().toInternalString("STATUS", mbo.getString("CLOSE"), mbo)=="CLOSE":
You're pretty close, but the arguments are slightly different. The first argument is for the domainid (in this case, WOSTATUS out of the box), and the second should be your status value. So your IF statement should look like this:if MXServer.getMXServer().getMaximoDD().getTranslator().toInternalString("WOSTATUS", mbo.getString("STATUS"), mbo)=="CLOSE":
The other thing I would add, is if you aren't on WOCHANGESTATUS (but an actual stateful MBO like WO), there's a much easier way to get the value. Everything that extends statefulmbo (which is most objects that have a status) has a public method called getInternalStatus(). So if this was WO itself, you could just call mbo.getInternalStatus()
from psdi.mbo import MboConstantsfrom psdi.server import MXServerif MXServer.getMXServer().getMaximoDD().getTranslator().toInternalString("STATUS", mbo.getString("CLOSE"), mbo)=="CLOSE": mbo.getMboValue("MEMO").setRequired(True)