cancel
Showing results for 
Search instead for 
Did you mean: 

targetLocation parameter in association.ftl

prasobhraj
Star Contributor
Star Contributor
Hi,

I want to use one folder in shared repository as target location in association.ftl . Please advice how to make it .

Path as below

Shared/Folder1/Folder2


I had tried by putting the noderef . its working fine. I need to make it with by specifying path. or is there any way to make it dynamically assign the target location?
1 ACCEPTED ANSWER

jpotts
World-Class Innovator
World-Class Innovator

It sounds like you know how to create an association using a node ref as the target. But what you'd like to do is use the path instead. So all you have to do is get the folder by path, then get that folder's node ref and then you know how to create the association from there.

Probably the easiest way to get something by path is to use search, like this:

SearchService.query(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE, SearchService.LANGUAGE_XPATH, "/app:company_home/cm:path/cm:to/cm:Folder1/cm:Folder2")

That returns a result set, then you can get the node from the result set and ask it for its node ref.

View answer in original post

2 REPLIES 2

jpotts
World-Class Innovator
World-Class Innovator

It sounds like you know how to create an association using a node ref as the target. But what you'd like to do is use the path instead. So all you have to do is get the folder by path, then get that folder's node ref and then you know how to create the association from there.

Probably the easiest way to get something by path is to use search, like this:

SearchService.query(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE, SearchService.LANGUAGE_XPATH, "/app:company_home/cm:path/cm:to/cm:Folder1/cm:Folder2")

That returns a result set, then you can get the node from the result set and ask it for its node ref.

Thanks Jeff. Let me try