- Subscribe to RSS Feed
- Mark as New
- Mark as Read
- Bookmark
- Subscribe
- Email to a Friend
- Printer Friendly Page
- Report Inappropriate Content
Scripting Access to Relationsh ips Tab
Status:
Implemented
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.
- Mark as Read
- Mark as New
- Bookmark
- Highlight
- Email to a Friend
- Report Inappropriate Content
- Mark as Read
- Mark as New
- Bookmark
- Highlight
- Email to a Friend
- Report Inappropriate Content
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
- Mark as Read
- Mark as New
- Bookmark
- Highlight
- Email to a Friend
- Report Inappropriate Content
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.
- Mark as Read
- Mark as New
- Bookmark
- Highlight
- Email to a Friend
- Report Inappropriate Content
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','DirectionTyp
e':'Bi-Directional', 'Description':'add your comments here']) - item.relationships.contains(selectedItem) tests for the existance of a related item, returns boolean
- Mark as Read
- Mark as New
- Bookmark
- Highlight
- Email to a Friend
- Report Inappropriate Content
- Mark as Read
- Mark as New
- Bookmark
- Highlight
- Email to a Friend
- Report Inappropriate Content
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...
- Mark as Read
- Mark as New
- Bookmark
- Highlight
- Email to a Friend
- Report Inappropriate Content
- Mark as Read
- Mark as New
- Bookmark
- Highlight
- Email to a Friend
- Report Inappropriate Content
@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.

