PLM 360 General Discussion

PLM 360 General Discussion

Reply
Mentor
dkeeley
Posts: 224
Registered: ‎10-04-2012
Message 1 of 8 (281 Views)
Accepted Solution

Running scripts on CO affected items

281 Views, 7 Replies
11-11-2012 01:44 PM

Hi,

 

I want to be able to run a script on the affected items of a CO when they promoted to the new state. I need to spawn some new items each of the affected items once they are released. I have had two thoughts about doing this but I need some input.

 

Approach 1

Add a script to the transition to the managed state in the change order workflow. This would require me to be able to read the affected items of the change order using a script. Is this possible?

 

Approach 2

Set up a script to run when each of the affected items are edited. This approach would require that a lifecyle or revison change is an item 'edit'. I'm not sure if this is the case

 

Thanks,

 

David.

Hi Joe,

 

I think the new 'workflow items' scripting functionality that's been added in the November update will solve my problem. It tool me a while to figure out the syntax but I think I've got it now.

 

//Load the item in the 'Affected Items' tab using the following;

var linked_item = loadItem(item.workflowItems[1].id);

 

//The make a change to any filed in the item using the following;;
linked_item.ORIENTATION = 'Vertical';

 

etc etc etc

 

I can create spawned items etc using this method I think.

 

Great work guys. Keep it up.

 

David.

Product Support
piggeej
Posts: 281
Registered: ‎03-27-2012
Message 2 of 8 (265 Views)

Re: Running scripts on CO affected items

11-12-2012 01:41 PM in reply to: dkeeley

David,

 

See you Private message inbox.



Joe Piggee
Support Specialist
Product Support
Autodesk, Inc.

Mentor
dkeeley
Posts: 224
Registered: ‎10-04-2012
Message 3 of 8 (258 Views)

Re: Running scripts on CO affected items

11-13-2012 02:54 AM in reply to: piggeej

Hi Joe,

 

See attached.

Product Support
piggeej
Posts: 281
Registered: ‎03-27-2012
Message 4 of 8 (248 Views)

Re: Running scripts on CO affected items

11-14-2012 08:37 AM in reply to: dkeeley

Hi David,

 

So for the long wait on the reply but I want to make sure to cover all options and questions that may arise when answering this. If I still am leaving a little confusion in this answer let me know.

 

Side note- Thank you for the great mental exercise!

 

Let’s get started shall we?

 

So looking at the diagram this could be possible but there is one thing stopping us.

 

How it could work:

You could build to different library workspace building scripts one for Contract items, one for Sales Specifications. Then you would call on these when the Change order item moved through the transition to the Managed state.

 

Why it won’t work:

Unfortunately with a current limitation on how scripts are executed in the system, if a workspace is spawned there is no way to know what the item is until after the script is done. So Change order would know that Sales were created and Contract was created also, It could also tell the workspaces that “XXXX” Change order created it but Sales and Contract wouldn’t be able to tell the Contact order how to find them.

 

How you could work around:

If you were to tell and store the parent item (the link to the Change order) in the Sales and Contract item, then on a spate transition with in the spawned workspaces you could have them write back to the original Change Order.

 

Other possible problems to consider:

Scalability- the more workspaces you are spawning the more time it takes for the JAVA engine to run. This is a variable factor based on what else is happening in the cloud when this is going on. So in theory it could work one time but not the next (theory being the key word here). So now it comes down to testing (lots of it) and a backup plan for how to check if this does fail, so that a failure goes unnoticed.

 

Once again thankyou for the question and I hope this answers everything!



Joe Piggee
Support Specialist
Product Support
Autodesk, Inc.

Mentor
dkeeley
Posts: 224
Registered: ‎10-04-2012
Message 5 of 8 (246 Views)

Re: Running scripts on CO affected items

11-14-2012 09:06 AM in reply to: piggeej

Hi Joe,

 

Wow. Thanks for the very detailed reply. Much appreciated.

 

I'll read over it tonight and get back to you tomorrow.

 

David.

Mentor
dkeeley
Posts: 224
Registered: ‎10-04-2012
Message 6 of 8 (238 Views)

Re: Running scripts on CO affected items

11-15-2012 07:43 AM in reply to: dkeeley

Hi Joe,

 

I spent some time digesting this last night. It seems that none of the proposed solutions will really do what I want them to do. The problem would be corrected if you were able to access relationships via scripts (like grid items). Can you provide me with any idea of when you hope to introduce this funtionality to PLM 360?

 

If I knew when relationship scripting was coming I would find a short-term manual work-around for this problem.

 

I know there's already a lot of chat about this in the IdeaStation.

 

Thanks,

 

David.

Product Support
piggeej
Posts: 281
Registered: ‎03-27-2012
Message 7 of 8 (236 Views)

Re: Running scripts on CO affected items

11-15-2012 08:27 AM in reply to: dkeeley

Hi David,

 

Glad the info helped, but sorry for it not giving you a solution you were looking for.

 

As for when access to relations via scripting being available? This I unfortunately don’t know at this time.

 

However because it is under development / review, I would highly recommend joining in and offering your ideas on the conversations about it in the IdeaStation. Not only will you be able to help molded it in the way you would like to see it, but you could also help us understand more about what users like you are trying to achieve with our product.



Joe Piggee
Support Specialist
Product Support
Autodesk, Inc.

Mentor
dkeeley
Posts: 224
Registered: ‎10-04-2012
Message 8 of 8 (227 Views)

Re: Running scripts on CO affected items

11-18-2012 01:23 PM in reply to: piggeej

Hi Joe,

 

I think the new 'workflow items' scripting functionality that's been added in the November update will solve my problem. It tool me a while to figure out the syntax but I think I've got it now.

 

//Load the item in the 'Affected Items' tab using the following;

var linked_item = loadItem(item.workflowItems[1].id);

 

//The make a change to any filed in the item using the following;;
linked_item.ORIENTATION = 'Vertical';

 

etc etc etc

 

I can create spawned items etc using this method I think.

 

Great work guys. Keep it up.

 

David.

Post to the Community

Have questions about Autodesk products? Ask the community.

New Post
Announcements
Do you have 60 seconds to spare? The Autodesk Community Team is revamping our site ranking system and we want your feedback! Please click here to launch the 5 question survey. As always your input is greatly appreciated.