PLM 360 General

Reply
Active Member
james.n.tennent
Posts: 12
Registered: ‎09-10-2008
Message 1 of 3 (119 Views)

Add relationship after creating item

119 Views, 2 Replies
04-14-2013 10:05 PM

Hi Again,

I seem to be finding all the bugs at the moment, although I hope I am wrong.

It doesn't look like I am able to create a new item through a script and Add It to the relationships tab at the same time

 

(Using the createNewItem library of course)

 

if(item.CREATE_CHANGE_ORDER === "Yes"){

var newProperties = [];

newProperties.LINKED_CAPA = item.descriptor.descriptor;

createNewItem('WS_UPGRADE', newProperties);

item.ASSOCIATED_CHANGE_ORDER = newItem;

item.relationships.addRelated(item.ASSOCIATED_CHANGE_ORDER,'Cross-Reference','Bidirectional','Link Change Order to CAPA');

 

}

 

each segment of the script works fine by itself however doesn't work together, my thought where I need to Add a delay to the item.relationship section however this didn't seem to help.

 

thanks again

 

James

 

 

 

Member
sarychev
Posts: 5
Registered: ‎04-03-2012
Message 2 of 3 (100 Views)

Re: Add relationship after creating item

04-15-2013 10:40 AM in reply to: james.n.tennent

Hi JamesI too try decide this issue...

You get error (java.lang.RuntimeException: Unable to save script results) ?


P.S. Maybe this features not supported, like a "scrypting-based" change owner (before last update) ?

Mentor
dkeeley
Posts: 214
Registered: ‎10-04-2012
Message 3 of 3 (89 Views)

Re: Add relationship after creating item

04-17-2013 01:46 AM in reply to: james.n.tennent

Hi James,

 

Maybe this would work?

 

if(item.CREATE_CHANGE_ORDER === "Yes"){

var newProperties = [];

newProperties.LINKED_CAPA = item.descriptor.descriptor;

var newItem = createNewItem('WS_UPGRADE', newProperties);

item.ASSOCIATED_CHANGE_ORDER = newItem;

item.relationships.addRelated(item.ASSOCIATED_CHANGE_ORDER,'Cross-Reference','Bidirectional','Link Change Order to CAPA');

 

Regards,

 

David.

You are not logged in.

Log into access your profile, ask and answer questions, share ideas and more. Haven't signed up yet? Register

Announcements
Are you familiar with the Autodesk Expert Elites? The Expert Elite program is made up of customers that help other customers by sharing knowledge and exemplifying an engaging style of collaboration. To learn more, please visit our Expert Elite website.

Ask the Community