将Maximo中的SR所有者设置为第一个查看者。

huangapple go评论39阅读模式
英文:

How to set Owner of SR in Maximo to first viewer

问题

我想创建自动化脚本,每当我在服务请求中的列表中选择票证,并且所有者为空时,将所有者填充为已登录用户。我无法使用带属性的自动化脚本启动,因为我不使用任何属性来启动脚本。我尝试使用带对象的自动化脚本,如果我选择事件初始化值,当我单击没有所有者的票证时,它可以工作,但当我想创建新的票证时,出现“historyflag”错误。

我能否以某种方式使用"mxevent=selectrecord"?

我使用简单的代码,变量为"owner=user"。

英文:

I want to create automation script, every time when I choose ticket in my list in service request and if owner is null to fill owner with logged user. I can not use automation script launch with attribute because I do not use any attribute to start script. I tried to use automation script with object and if I choose event initialize the value it's working when I click on ticket without owner, but when I want to create new ticket I have error with historyflag.

Can I use mxevent=selectrecord somehow?

I use simple code with variable owner=user.

答案1

得分: 0

不要使用对象的Initialize事件作为启动点,而应该使用对象的Save->Before Save事件,并设置事件条件为:owner为空且:historyflag等于0。这将在保存时为owner设置值,前提是owner尚未设置。

依我之见,出于多种原因,这种方法比您所要求的更可取。首先,当用户加载记录时,他们将能够看到它是未分配的。其次,只有当用户进行其他更改时,记录才会进行自动更改。最后,如果用户只加载记录然后导航离开,不会要求他们保存。

但是,如果您确实需要您所要求的功能,以下脚本应该在Attribute->Initialize上的启动点上起作用。

# 当用户加载记录时,Maximo会创建一个只包含该记录的新MboSet。在没有访问UI的情况下,检查我们的Mbo是否是集合中唯一的Mbo,等同于检查我们是否不在“List”选项卡上。
if (not mbo.getThisMboSet().getMbo(1) 
        and not mbo.isFlagSet(mbo.READONLY)
        and not thisvalue):
    thisvalue = user
英文:

Instead of using the Object->Initialize event for your launch point, you should use Object->Save->Before Save and have an Event Condition of :owner is null and :historyflag = 0. This will cause owner to get set whenever you save and owner is not already set.

In my opinion, this is preferred over what you asked for for several reasons. First, when the user loads the record, they will be able to see that it is unassigned. Second, automated changes to the record will not be made unless the user makes other changes as well. Finally, the user will not be asked to save if they just load the record and then navigate away.

However, if you really want what you asked for, the following script with a launch point on Attribute->Initialize should work.

# When a user loads a record, Maximo makes a new MboSet with just that
# record. Without access to the UI, checking that ours is the only Mbo 
# in the set is close to checking that we are NOT on the List tab.
if (not mbo.getThisMboSet().getMbo(1) 
        and not mbo.isFlagSet(mbo.READONLY)
        and not thisvalue):
    thisvalue = user

huangapple
  • 本文由 发表于 2023年2月8日 21:07:38
  • 转载请务必保留本文链接:https://go.coder-hub.com/75386262.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定