Maximo List Archive

This is an archive of the Maximo Yahoo Community. The content of this pages may be a sometimes obsolete so please check post dates.
Thanks to the community owner Christopher Wanko for providing the content.



Seting Field Value with Automation Script

From: (2014-02-17 02:07)

Maximo 7.5

I have created a cloned application of WO and added an extra field LR_RECTYPE to limit the records returned with the application (PSESCANS). I have set the default value of "PSE" withing application designer and that works fine except when I apply a job plan, then the task work orders do not have my default value. How can I set this value with an automation script for the task work orders?


From: Chris Lawless (2014-02-17 06:27)

Create an object level automation script for the onAdd event for WOACTIVITY that copies the value from the parent to the child.
On February 17, 2014 at 5:07:28 AM EST, mlevinson@ledgesoft.com wrote:   Maximo 7.5I have created a cloned application of WO and added an extra field LR_RECTYPE to limit the records returned with the application (PSESCANS). I have set the default value of "PSE" withing application designer and that works fine except when I apply a job plan, then the task work orders do not have my default value. How can I set this value with an automation script for the task work orders?


From: (2014-02-17 03:31)

Thanks Chris,

Can you please provide an example of what that syntax might look like?


From: Ian Wright (2014-02-17 12:05)

As Chris said try this on WOACTIVITY

PARENTPROCESS – this relationship already exists and after a quick look it seems to return a 1:1 :-

In variable IN_LR_RECTYPE bound to PARENTPROCESS.LR_RECTYPE
Out variable OUT_LR_RECTYPE bound to LR_RECTYPE
Script

OUT_LR_RECTYPE = in_LR_RECTYPE

From: MAXIMO@yahoogroups.com [mailto:MAXIMO@yahoogroups.com] On Behalf Of mlevinson@ledgesoft.com
Sent: 17 February 2014 10:07
To: MAXIMO@yahoogroups.com
Subject: [MAXIMO List] Seting Field Value with Automation Script



Maximo 7.5

I have created a cloned application of WO and added an extra field LR_RECTYPE to limit the records returned with the application (PSESCANS). I have set the default value of "PSE" withing application designer and that works fine except when I apply a job plan, then the task work orders do not have my default value. How can I set this value with an automation script for the task work orders?


GDF SUEZ E&P UK Ltd (Company Number 3386464), registered in England and Wales with a registered office address at: 40 Holborn Viaduct, London, EC1N 2PB.

**************************************************************************************************************
This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed.
If you have received this email in error please notify the system manager.
**************************************************************************************************************


From: Chris Lawless (2014-02-17 07:12)

I don't have an example to have (I can send later) but you really want to navigate to the parent using the getOwner() method rather than using a relationship, the relationship requires that the parent has already been saved to the database whereas referencing to owner will retrieve the value from an unsaved parent.
You also want to consider what you expect yo happen should the RECTYPE be changed - do you allow this?
Chris.
Sent from my iPad
> On Feb 17, 2014, at 7:05 AM, Ian Wright <ian.wright@gdfsuezep.co.uk> wrote:
>
> As Chris said try this on WOACTIVITY
>
>
>
> PARENTPROCESS – this relationship already exists and after a quick look it seems to return a 1:1 :-
>
>
>
> In variable IN_LR_RECTYPE bound to PARENTPROCESS.LR_RECTYPE
>
> Out variable OUT_LR_RECTYPE bound to LR_RECTYPE
>
> Script
>
>
>
> OUT_LR_RECTYPE = in_LR_RECTYPE
>
>
>
> From: MAXIMO@yahoogroups.com [mailto:MAXIMO@yahoogroups.com] On Behalf Of mlevinson@ledgesoft.com
> Sent: 17 February 2014 10:07
> To: MAXIMO@yahoogroups.com
> Subject: [MAXIMO List] Seting Field Value with Automation Script
>
>
>
>
>
> Maximo 7.5
>
> I have created a cloned application of WO and added an extra field LR_RECTYPE to limit the records returned with the application (PSESCANS). I have set the default value of "PSE" withing application designer and that works fine except when I apply a job plan, then the task work orders do not have my default value. How can I set this value with an automation script for the task work orders?
>
>
> GDF SUEZ E&P UK Ltd (Company Number 3386464), registered in England and Wales with a registered office address at: 40 Holborn Viaduct, London, EC1N 2PB.
>
>
> ****************************************************************************************************************************************************************************************
> This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed.
>
> If you have received this email in error please notify the system manager.
> ****************************************************************************************************************************************************************************************
>
>


From: (2014-02-17 04:15)

Chris,

LR_RECTYPE does not change. It is a value that I use to filter records for the application. I would appreciate any examples you can provide. I am trying to get a handle on Automation Scripting and with each one I create I am becoming a bit more familiar with syntax and usage of the app.


From: (2014-02-17 04:18)

Ian,

I tried the method you provided, but it is not setting the LR_RECTYPE value for task WO's.
I certainly appreciate your help.


From: Ian Wright (2014-02-17 12:22)

Chris was right you need the header to be saved the syntax will be something like the following no time to test sorry

mbo.setValue(' LR_RECTYPE ',mbo.getOwner().getThisMboSet().getDouble('LR_RECTYPE'),11L)

give it a try

From: MAXIMO@yahoogroups.com [mailto:MAXIMO@yahoogroups.com] On Behalf Of mlevinson@ledgesoft.com
Sent: 17 February 2014 12:19
To: MAXIMO@yahoogroups.com
Subject: Re: [MAXIMO List] Seting Field Value with Automation Script



Ian,

I tried the method you provided, but it is not setting the LR_RECTYPE value for task WO's.
I certainly appreciate your help.


GDF SUEZ E&P UK Ltd (Company Number 3386464), registered in England and Wales with a registered office address at: 40 Holborn Viaduct, London, EC1N 2PB.

**************************************************************************************************************
This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed.
If you have received this email in error please notify the system manager.
**************************************************************************************************************


From: Chris Lawless (2014-02-17 07:24)

This example is from Bruno's blog here http://maximodev.blogspot.com/2013/05/link-parent-child-records-in-maximo.html
from psdi.mbo import MboConstants mbo.setValue('TB1ID', mbo.getOwner().getString("TB1ID"), MboConstants.NOACCESSCHECK))
You really want to add a check to ensure the record has a value first, something like
If (mbo.getOwner()):
Sent from my iPad
> On Feb 17, 2014, at 7:15 AM, <mlevinson@ledgesoft.com> wrote:
>
> Chris,
>
> LR_RECTYPE does not change. It is a value that I use to filter records for the application. I would appreciate any examples you can provide. I am trying to get a handle on Automation Scripting and with each one I create I am becoming a bit more familiar with syntax and usage of the app.
>
>


From: Ian Wright (2014-02-17 12:28)

Or ☺

mbo.setValue(' LR_RECTYPE ',mbo.getOwner().getString('LR_RECTYPE'),11L)

From: MAXIMO@yahoogroups.com [mailto:MAXIMO@yahoogroups.com] On Behalf Of Ian Wright
Sent: 17 February 2014 12:22
To: MAXIMO@yahoogroups.com
Subject: RE: [MAXIMO List] Seting Field Value with Automation Script


Chris was right you need the header to be saved the syntax will be something like the following no time to test sorry

mbo.setValue(' LR_RECTYPE ',mbo.getOwner().getThisMboSet().getDouble('LR_RECTYPE'),11L)

give it a try

From: MAXIMO@yahoogroups.com [mailto:MAXIMO@yahoogroups.com] On Behalf Of mlevinson@ledgesoft.com
Sent: 17 February 2014 12:19
To: MAXIMO@yahoogroups.com
Subject: Re: [MAXIMO List] Seting Field Value with Automation Script



Ian,

I tried the method you provided, but it is not setting the LR_RECTYPE value for task WO's.
I certainly appreciate your help.

GDF SUEZ E&P UK Ltd (Company Number 3386464), registered in England and Wales with a registered office address at: 40 Holborn Viaduct, London, EC1N 2PB.

****************************************************************************************************************************************************************************************
This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed.

If you have received this email in error please notify the system manager.
****************************************************************************************************************************************************************************************


From: (2014-02-17 04:35)

Thank you both gentlemen.

the following
mbo.setValue(' LR_RECTYPE'),mbo.getOwner().getString('LR_RECTYPE'),11L)
or
from psdi.mbo import MboConstants mbo.setValue('LR_RECTYPE', mbo.getOwner().getString("LR_RECTYPE"), MboConstants.NOACCESSCHECK))

Both return:
BMXAA7836E - The script did not compile.
sun.org.mozilla.javascript.internal.EvaluatorException: missing ; before statement (<Unknown Source>#1)

When using javascript , do i need to define any variables?


From: Ian Wright (2014-02-17 12:41)

mbo.setValue(' LR_RECTYPE'),mbo.getOwner().getString('LR_RECTYPE'),11L)

there is a space in the one above -- removed :-

mbo.setValue('LR_RECTYPE'),mbo.getOwner().getString('LR_RECTYPE'),11L)


for the one below

from psdi.mbo import MboConstants


From: MAXIMO@yahoogroups.com [mailto:MAXIMO@yahoogroups.com] On Behalf Of mlevinson@ledgesoft.com
Sent: 17 February 2014 12:36
To: MAXIMO@yahoogroups.com
Subject: Re: [MAXIMO List] Seting Field Value with Automation Script



Thank you both gentlemen.

the following
mbo.setValue(' LR_RECTYPE'),mbo.getOwner().getString('LR_RECTYPE'),11L)
or
from psdi.mbo import MboConstants mbo.setValue('LR_RECTYPE', mbo.getOwner().getString("LR_RECTYPE"), MboConstants.NOACCESSCHECK))

Both return:
BMXAA7836E - The script did not compile.
sun.org.mozilla.javascript.internal.EvaluatorException: missing ; before statement (<Unknown Source>#1)

When using javascript , do i need to define any variables?


GDF SUEZ E&P UK Ltd (Company Number 3386464), registered in England and Wales with a registered office address at: 40 Holborn Viaduct, London, EC1N 2PB.

**************************************************************************************************************
This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed.
If you have received this email in error please notify the system manager.
**************************************************************************************************************


From: (2014-02-17 04:44)

I am sorry guys but with the following:

from psdi.mbo import MboConstants
mbo.setValue('LR_RECTYPE'),mbo.getOwner().getString('LR_RECTYPE'),11L)

I get the same error. I have not defined any variables.


From: Ian Wright (2014-02-17 12:49)

The
from psdi.mbo import MboConstants

is not required in the example below as I used 11L


I have tested the above with script language set as Jython with no errors when the script is saved
When are you getting the error ?

From: MAXIMO@yahoogroups.com [mailto:MAXIMO@yahoogroups.com] On Behalf Of mlevinson@ledgesoft.com
Sent: 17 February 2014 12:44
To: MAXIMO@yahoogroups.com
Subject: Re: [MAXIMO List] Seting Field Value with Automation Script



I am sorry guys but with the following:

from psdi.mbo import MboConstants
mbo.setValue('LR_RECTYPE'),mbo.getOwner().getString('LR_RECTYPE'),11L)

I get the same error. I have not defined any variables.


GDF SUEZ E&P UK Ltd (Company Number 3386464), registered in England and Wales with a registered office address at: 40 Holborn Viaduct, London, EC1N 2PB.

**************************************************************************************************************
This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed.
If you have received this email in error please notify the system manager.
**************************************************************************************************************


From: (2014-02-17 04:54)

I am getting the following error when I click the "create" button in the automation script application, using the jython language

mbo.setValue('LR_RECTYPE'),mbo.getOwner().getString('LR_RECTYPE'),11L)

BMXAA7836E - The script did not compile.
SyntaxError: mismatched input ')' expecting NEWLINE in <script> at line number 1 at column number 69


From: Sarah Stewart (2014-02-17 08:00)

Why wouldn't you just add the value to the job plan and have it cross over to woactivity when the job plan is used. This way you'll be covered from WO created from wogen and work orders manually created from PM application. Set/fix the data at the source (JobPlans task) instead if midstream.
> On Feb 17, 2014, at 6:27 AM, Chris Lawless <lawlessc@gmail.com> wrote:
>
> Create an object level automation script for the onAdd event for WOACTIVITY that copies the value from the parent to the child.
>
>
>> On February 17, 2014 at 5:07:28 AM EST, mlevinson@ledgesoft.com wrote:
>>
>> Maximo 7.5
>>
>> I have created a cloned application of WO and added an extra field LR_RECTYPE to limit the records returned with the application (PSESCANS). I have set the default value of "PSE" withing application designer and that works fine except when I apply a job plan, then the task work orders do not have my default value. How can I set this value with an automation script for the task work orders?
>>
>
>


From: (2014-02-17 05:16)

Sarah,

This was my initial approach, but I was not able to get the attribute LR_RECTYPE to cross over from the JPTASK to the work order when the job plan was applied.


From: Chris Lawless (2014-02-17 08:17)

If in doubt, count the parentheses...
mbo.setValue('LR_RECTYPE',mbo.getOwner().getString('LR_RECTYPE'),11L)
Sent from my iPad
> On Feb 17, 2014, at 7:54 AM, <mlevinson@ledgesoft.com> wrote:
>
> mbo.setValue('LR_RECTYPE'),mbo.getOwner().getString('LR_RECTYPE'),11L)


From: (2014-02-17 05:50)

Chris,
I should have caught that...ughhh
The script compiled successfully. After creating a new work order and applying the job plan, the field is not being populated. I have the script set to fire on "Add"

select wonum,lr_rectype from maximo.workorder where siteid = 'PSE' and wonum in ('11583','11584')
WONUM LR_RECTYPE
11583 PSE
11584 NULL


From: Chris Lawless (2014-02-17 09:32)

OnAdd of WOACTIVITY or WORKORDER?
On February 17, 2014 at 8:50:43 AM EST, mlevinson@ledgesoft.com wrote:   Chris, I should have caught that...ughhhThe script compiled successfully. After creating a new work order and applying the job plan, the field is not being populated. I have the script set to fire on "Add"select wonum,lr_rectype from maximo.workorder where siteid = 'PSE' and wonum in ('11583','11584')WONUM    LR_RECTYPE11583          PSE11584          NULL


From: (2014-02-17 06:32)

Chris,

WOACTIVITY


From: Chris Lawless (2014-02-17 09:34)

You're not in admin mode...? Try WORKORDER but if you do make sure you confirm it's a child before referencing the owner or you'll get a exception.
On February 17, 2014 at 9:32:52 AM EST, mlevinson@ledgesoft.com wrote:   Chris,WOACTIVITY


From: (2014-02-17 07:31)

That did it Chris. Thank you so much. I am not sure what I would do without this forum and folks like you and Ian that do your very best to help when you can.


From: Sarah Stewart (2014-02-17 11:37)

You may want to verify it works as desired when a WO is created via the wogen cron AND manually from the select action menu within PMs. Just to make sure all your bases are covered.
> On Feb 17, 2014, at 10:31 AM, <mlevinson@ledgesoft.com> wrote:
>
> That did it Chris. Thank you so much. I am not sure what I would do without this forum and folks like you and Ian that do your very best to help when you can.
>
>