cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Scripting Access to Relationships Tab

Scripting Access to Relationships Tab

It is often both difficult and tedious to manually create relationships between different workspace items (as the picture below illustrates). It would save a lot of time to be able to write scripts to automatically add relationships between workspace items. 

 

Even tying the ability to add relationships into the function createItem('WS_WORKSPACE_ID') would be a huge time saver.

 

 

 

Item Relationships

11 Comments
jared.sund
Alumni
Status changed to: Future Consideration
 
ACapuzzo
Participant

It would be great. Relationship is ALL in data management.

DonovanJr
Advocate

Hear Hear, The relationships make it all worth it.

 

Scripts are great for minimizing data entry and tranfer of information. but linking things together is what makes PLM above the rest.

 

Bob Donovan

punisher
Collaborator

Very much agree. Creating reporting WS items from script in workflow, only to have to go and add a relationship to the two. Would seem natural to already have a relationship upon creation that could be established in same script.

 

This would require a return value on the createWS function (or is that too C++ like??)

 

 

var NewWS = (CreateWSite.......);

item.relationships.add(NewWS, 1, "My relationship description");

 

Something like this.

jared.sund
Alumni

Here's the syntax I'm thinking for this feature.  Let me know if you think I've missed anything.  Also, I'll likely repeat this same syntax for workflow items, project, etc...

 

  • item.relationships is an array of the line items on the relationships tab
  • item.relationships[n] is the nth item on the tab
  • item.relationships[n].item is the target item that the nth item on the tab refers to
  • item.relationships[n].id is the DMS ID of that target item
  • item.relationships[n].descriptor is the descriptor of that target item
  • item.relationships[n].FIELD_NAME is the value of the field named “FIELD_NAME” on the nth workflow item
  • item.relationships[n].item.FIELD_NAME is the value of the field named “FIELD_NAME” on the target item
  • item.relationships[n].remove() removes the nth item in the list
  • item.relationships.add(['ITEM':selectedItem, 'RelationshipType':'Cross-Reference','DirectionType':'Bi-Directional', 'Description':'add your comments here'])
  • item.relationships.contains(selectedItem) tests for the existance of a related item, returns boolean
jared.sund
Alumni
Status changed to: Implemented
This has been added in the Feb. 2013 PLM 360 release
sarychev
Participant

Hi everyone

After reading scrypting reference, i create this scrypt:


newItem = createItem('WS_PROJECT')
item.relationships.addRelated(newItem, 'Cross-Reference', 'Bidirectional', 'AutoADD');

 

But after sucessfully test (not mistakes in syntax) i have problem "[ENDPHASE] java.lang.RuntimeException: Unable to save script results"

 

P.S. Maybe this features not supported, like a "scrypting based" change owner  ?

 

Sorry for my English...

jared.sund
Alumni
Status changed to: 投票募集中
 
jared.sund
Alumni

@sarychev, this would be a better question to be raised on the support fourms site.  The support team can surely help you with this issue.

 

http://forums.autodesk.com/t5/Autodesk-PLM-360/bd-p/705

sarychev
Participant

@jared.sund Thanks. I will try.

nguyentru
Alumni
Status changed to: Implemented
 

Can't find what you're looking for? Ask the community or share your knowledge.

Submit Idea  

Autodesk Design & Make Report