Yes you can check the status. Assuming you have job plan revisioning enabled, you really shouldn't have people delete attachments outside of DRAFT & PNDREV statuses. If job plan revisioning isn't enabled in your system then Maximo would allow edits to ACTIVE job plan revisions. To do a status based check you would do something like:
if owner and owner.getName()=="JOBPLAN" and owner.getInternalStatus()=="ACTIVE":
service.error("emx","test")
The getInternalStatus() portion is an important concept in Maximo. You could choose to utilize something like owner.getString("STATUS") but this will return the literal status. If your organization has (or adds in the future) any synonym values then your code would have to write in every potential status. By calling getInternalStatus(), we're getting the maxvalue of the current status. New internal values are rarely added by the product and can't be added by customers. Right now it would be 1 of 6 internal values (ACTIVE, CANCEL, DRAFT, INACTIVE, PNDREV, or REVISED).
------------------------------
Steven Shull
------------------------------
Original Message:
Sent: Mon September 12, 2022 01:33 PM
From: Shannon Stommel
Subject: Multiple Conditional Properties on Attachments
Thank you very much!
Is there a way to check on the Job Plan status from the script you added with the launch point being DOCLINKS?
------------------------------
Shannon Stommel
Original Message:
Sent: Fri September 09, 2022 08:09 AM
From: Steven Shull
Subject: Multiple Conditional Properties on Attachments
I would create an automation script on the DOCLINKS object with an Allow Object Deletion launch point. This launch point allows you to throw an error to prevent deleting a record and you can define your own set of criteria for what that should be. If you wanted it to be based on a signature option, you can check for that by calling the sigopGranted on the job plan MBO. Something like below. DELETEATTACH signature option doesn't exist so you'd have to create it or use a different signature option. Similar for the error message that I'm throwing. But then when the user doesn't have the permission they wouldn't be able to delete any attachments on Job Plans.
We have to check the owner object and verify it's JOBPLAN here since the DOCLINKS object is used throughout Maximo for attachments and we don't want to impact other records.
owner=mbo.getOwner()if owner and owner.getName()=="JOBPLAN" and not owner.sigopGranted("DELETEATTACH"): service.error("emx","test")
------------------------------
Steven Shull
Original Message:
Sent: Thu September 08, 2022 04:33 PM
From: Shannon Stommel
Subject: Multiple Conditional Properties on Attachments
We are wanting to restrict who can delete attachments in the Job Plan application. We currently have a sigoption on the attachments to be red if there is an attachment. Not sure how we also can also add security to whom can delete the attachments as we can only have 1 sigoption on the field.
------------------------------
Shannon Stommel
------------------------------
#Maximo
#AssetandFacilitiesManagement