Fusion Manage Forum
Welcome to Autodesk’s Fusion Manage (formerly Fusion 360 Manage) Forum. Share your knowledge, ask questions, and explore popular Fusion Manage topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Automated Linking of Items

9 REPLIES 9
SOLVED
Reply
Message 1 of 10
obourne
686 Views, 9 Replies

Automated Linking of Items

I'd like to have a script (or something) link two items. Here is my scenario:

 

I have a revision controlling workspace item. In the item details tab I will choose an item from a revision controlled workspace via a picklist. Upon saving I want that selected item to automatically be added to the linked items tab. Is there a scripting function that can do that?

Tags (1)
9 REPLIES 9
Message 2 of 10
jpiggee
in reply to: obourne

Orrin,

 

As of this release ( 8.0) you cannot script to the linked Items tab, however this is in development and will be available on a future release.

Joseph Piggee
Fusion 360 Administrator
TPI Composites
jpiggee@tpicomposites.com
Message 3 of 10
obourne
in reply to: jpiggee

Thanks for the info.

 

Is there a way script additions to the relationships tab?

Message 4 of 10
jpiggee
in reply to: obourne

Yes, Adding items to the relationship tab is now supported. (as of 8.0)

The Wiki will be updated shortly but here’s the basic notes on this.

 

 

 

 

The relationship tab support will follow the same basic design as grid and workflow items.

 

The features supported:

 

item.relationships -- A list of relationships

item.relationships.addRelated({ RELATED: target, TYPE: typeStr, DIRECTION: dir, DESCRIPTION: desc }) – Adds relationship to list

item.relationships.addRelated(target, typeStr, dir, desc) – Adds relationship to list

 

dir is optional, and defaults to Unidirectional. Will be bidirectional if dir is 2 or "bidirectional" (case insensitive)

desc is optional, and defaults to blank

 

item.relationships[i] has the following properties:

  item.relationships[i].id – DMS ID of target item

  item.relationships[i].descriptor – Descriptor of target item

  item.relationships[i].item – Target item

  item.relationships[i].item.FIELD – Field on target item

  item.relationships[i].type – Relationship type name

  item.relationships[i].direction – One of “Unidirectional” or “Bidirectional”

  item.relationships[i].description – Relationship type description

 

item.relationships[i].setRelationshipType(typeStr) – Sets the relationship type to “typeStr” (or throws an error if “typeStr” is not valid)

item.relationships[i].setDescription(desc) – Sets the relationship description to “desc”

item.relationships[i].remove() – Removes relationship i from the list

Joseph Piggee
Fusion 360 Administrator
TPI Composites
jpiggee@tpicomposites.com
Message 5 of 10
obourne
in reply to: jpiggee

Thanks. That should help for another workflow I'm devolping.

 

What permisions are needed? I assume the logged in user credentials will be uase for the permission ergo the user must have permission to add to an items relationships tab? Is this correct?

Message 6 of 10
jpiggee
in reply to: obourne

Correct, If the user has the proper perrmissions for that tab, then the script will be able to write to it.

Joseph Piggee
Fusion 360 Administrator
TPI Composites
jpiggee@tpicomposites.com
Message 7 of 10

I've been trying to implement this within a script and having difficulty with formating "RELATED: target".  Would you be able to provide an example of target? 

 

item.relationships.addRelated(target, typeStr, dir, desc)

 

My goal is to evaluate a field for the customer name, and if it exists, grab the related workspace item and make a relationship.

 

Darren Hartenstine

 

 

Message 8 of 10

Darren,

 

Target is equal to the descriptor of the target item you wish to add, from the workspace you have predefined.

 

So an example would be:

item.relationships.addRelated(descriptor of item you want to add, type of relationship, direction of relationship, description of relationship)

Joseph Piggee
Fusion 360 Administrator
TPI Composites
jpiggee@tpicomposites.com
Message 9 of 10

Thanks Joe for the reply.  I am very new to scripting, so I appoligize for more clarification.

 

I have a workspace for managing customers and the descriptor is set to a field called "NAME".  Is this the descriptor of the Workspace you are referring to?

 

item.relationships.addRelated('Customer Name1','Cross-Reference','Bidirectional','Test');

item.relationships.addRelated('Customer Name2','Cross-Reference','Bidirectional','Test');

 

My confusion is that the workspace I am working in is different from the customer workspace.  I feel like I am formating the target wrong and it needs ID's, or something.

Message 10 of 10

Hi Darren,

 

You can verify the descriptor value by going through a very simple test:

 

- browse to any item that can have relationships

- locate in URL dmsID and workspaceID values 

e.g. using this URL https://mytenant.autodeskplm360.net/workspace#workspaceid=50&dmsid=20432&tab=relationship, the workspace ID is 50 and the item dmsID is 20432.

- add a new relationship to the item

- create new action script that will solely be used for testing

- edit action script to have this single line of code

 

println(item.relationships[0].descriptor);

 

Run a test after inputting the dmsID and workspace ID. This will return the descriptor string you are after.

 

I hope this helps.



Bastien Mazeran

Technical Support Specialist

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

Post to forums  

Autodesk Design & Make Report