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: 

Hyperlink not visible when cloning from a workspace

8 REPLIES 8
Reply
Message 1 of 9
martin.garneau
931 Views, 8 Replies

Hyperlink not visible when cloning from a workspace

Here is my issue. We have a Workspace A, which we are creating PROJECTS and a Workspace B where we have our ITEMS.

From the Project workspace we are running a script to create an ITEM which is locate in the Item workspace

When doing this, we can see the associated Item that was created in the Project workspace as an hyperlink. 

 

My problem is when we are adding new ITEM to this same PROJECT by using the Cloned function from the ITEM workspace, we cant see the hyperlink in the Project workspace, However we can see the Project hyperlink from the Item workspace.

Is their a way to get the hyperlink into the PROJECT workspace when using the clone? below is our scritp for the clone item. 

 

/*
functionality: Creates a new item with the passed properties
input : baseItemName(string) - WorkSpace ID for the new item
: newItemProperties(associative array) -- Key(string) = New Item Field ID, Value = Field's value
return :
example :
var newProperties = new Array();
newProperties['TITLE'] = "This is an eample;
newProperties['QTY'] = 5;

createNewItem('WS_NAME', newProperties);
*/

function createNewItem(baseItemName, newItemProperties){

newItem = createItem(baseItemName);

for(var propKey in newItemProperties){
newItem[propKey] = newItemProperties[propKey];
}

return newItem;
}

 

I tried adding the below which was not successful : 

//Add Item to NPD Related Items
if (item.ASSOCIATED_NPD !== null){
var npdRecord = item.ASSOCIATED_NPD;
npdRecord.relationships.addRelated(item, 'Cross-Reference', 'Unidirectional', 'Item');
}

 

Labels (1)
8 REPLIES 8
Message 2 of 9

Have you tried changing Unidirectional to Bidireçional, in your script?
Does that gve you what you need?
Message 3 of 9

Tks for the reply. I just tried and it still do not create the link of the Item into the Project Workspace for this cloned item.

 

Any other suggestions?

Thanks

 

 

Message 4 of 9

I assume that you connect PROJECT and ITEM using the Relationships tab, correct? Do you use bi-directional relationships?

 

I just tried out your use case in my env: When I clone an ITEM which is linked to PROJECT in the relationships tab, the new ITEM clone will also be shown in the relationships tab of a PROJECT.

 

I guess that there is an onCreate script for the ITEM workspace. Does this script maybe change the relationships?

Message 5 of 9

Yes what you test is correct and i also see the project in the ITEM. My problem is if I go in the PROJECT workspace, i cant see the cloned items. I can only see the item that was created from the PROJECT workspace, which create some confusion, as we hvae a team working only from the Project workspace and need to also see all item related to this projects.

 

Im not really sure about the relationship but below are our 3 scripts we have for item creating and clone

 

CREATE ITEM script is as per below - FROM THE PROJECT WORKSPACE

//Initialize Variables
var newProperties = [];

//Create new Item
newProperties.PRODUCT_NAME = item.PROJECT_NAME;
newProperties.PRODUCT_CATEGORY = item.PRODUCT_CATEGORY;
nnewProperties.BRAND_NAME = item.BRAND_NAME;
newProperties.SUPPLIER = item.SUPPLIER;
newProperties.PROJECT_ENGINEER = item.PROJECT_ENGINEER;
newProperties.PRODUCT_MANAGER = item.PRODUCT_MANAGER;
newProperties.NPD_DMSID = item.NPD_DMSID;
newProperties.ASSOCIATED_NPD = item;

var newItem = createNewItem("WS_ITEMS", newProperties);
item.ASSOCIATED_ITEMS.add(newItem);

 

Item_On_Create script is below. - FROM THE ITEM WORKSPACE

//Create UPC Code
if (item.NUMBER !== null && item.NUMBER !== item.CURRENTITEMNUMBER){
item.UPC_CODE = createUPC(item.NUMBER);
item.CURRENTITEMNUMBER = item.NUMBER;
}

//Add Item to NPD Related Items
if (item.ASSOCIATED_NPD !== null){
var npdRecord = item.ASSOCIATED_NPD;
npdRecord.relationships.addRelated(item, 'Cross-Reference', 'Unidirectional', 'Item');
}

//Record Original DMSID
item.ORIG_DMSID = item.master.dmsID;

 

 

Our createNewItem script (cloned) is as per below - From ITEM Workspace

/*
functionality: Creates a new item with the passed properties
input : baseItemName(string) - WorkSpace ID for the new item
: newItemProperties(associative array) -- Key(string) = New Item Field ID, Value = Field's value
return :
example :
var newProperties = new Array();
newProperties['TITLE'] = "This is an eample;
newProperties['QTY'] = 5;

createNewItem('WS_NAME', newProperties);
*/

function createNewItem(baseItemName, newItemProperties){

newItem = createItem(baseItemName);

for(var propKey in newItemProperties){
newItem[propKey] = newItemProperties[propKey];
}

return newItem;
}

 

Hope this can help

Thanks

Message 6 of 9

Thank you for sharing the scripts, this helps a lot.

From the scripts, I can see that your ITEM has a field "ASSOCIATED_NPD" which refers to the related PROJECT. The create event of the ITEM will validate if a project is defined in this given field (no matter if the item is being cloned or created by the project). If a PROJECT is set in this field, then the PROJECT will be connected to the ITEM. All seems to be set up properly and this use case is working fine on my side.

 

How do you create the clone of the ITEM, do you use the standard Clone feature of FLC or do you use a custom script to do so? Does this new clone show the given PROJECT in field ASSOCIATED_NPD?

 

Message 7 of 9

Tks for your reply.

yes We can see the hyperlink for the associated Project in the Item when we clone it and if we do a search by project, we can see the item as well since those are linked.

 

The problem we cant see the Associated Item in the Project itself. We can only see item created within the Project workspace. Once the 1 item is created and if we want to clone it vs creating new item to save some time, we need to go in the ITEM workspace, and clone it. But this wont bring the hyperlink in the PROJECT workspace and only the 1st item will be visible

 

I listed out our 3 script above that we have. 

- Item_On_Create : Item creation from the Project workspace

- Create Item: Item creation from the Item workspace ( We don't use it as we cant assign a project to )

- CreateNewItem: Item clone from the Item workspace

 

Hope this help

tks

Message 8 of 9

I understand the problem, but I do not understand why the use case does not work as expected. Based on what you described, all seems to be fine. Can you please verify that the script Item_On_Create is attached to the create event of your ITEM workspace (see the Behaviors utility within the Workspace Manager)?

 

Btw, the "createNewItem script (cloned)" does not do anything it all as the function call (createNewItem('WS_NAME', newProperties);) is within the comments section (before '*/');

Message 9 of 9

I just looked at the Behavior in the ITEM workspace and yes the "Item_On_Create" is there.

 

I also looked into the NDP workspace and the "Create items" script  is there. Should we have the Cloned item script out there? so it create the hyperlink?

 

Thanks

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

Post to forums  

Autodesk Design & Make Report