cancel
Showing results for 
Search instead for 
Did you mean: 

Create association between 2 nodes using GUID

spdaly
Champ in-the-making
Champ in-the-making
I am stuck on a Javascript webscript that gets the GUID of a node and needs to create an association to another node.  Here's the scenario:

A "design" is made up of several "art" files.  The webscript's intent is to create the "design" node and associate the "design" node to the "art" nodes that are in the "design."  The client program POSTs all the information to create the "design" node including a list of the associated "art" GUIDs.  I create the "design" node and create all the correct properties.  Now I need to create the associations.  I have the GUIDs, but I'm stuck on how I create ScriptNodes for the "art" nodes so that I have the source/destination for the association.

I found another post that says that creating a ScriptNode is very simple given the GUID.  It links to the JavaScript API doc on the wiki, but I'm completely missing it.

Thanks for the help,


Steve
1 REPLY 1

lyamamot
Champ in-the-making
Champ in-the-making
I would just query for the nodes by ID. If you want to be lazy, you can assume the Store ID and use the following code:
var node = search.findNode("workspace://SpacesStore/" + args.id);
I'm not really sure what to do if you don't want to hardcode the Store.