I'm kind of new to the relationservice and how it works, but awesome feature so far. I'm still trying to figure out one simple thing, is it only possible to "create" a relation when copying a node?
Context: Site with two languages i'm connecting so when you switch from one to another, it switches to the respective node/page in the other language.
I'm trying to connect / set relation on two nodes, after I've created them, but don't think it's possible?
There is an example of creating a relation in that, regarding favourites.
var rs = ApplicationContext.Current.Services.RelationService;
// create relation
var relType = rs.GetRelationTypeByAlias("memberFavorites");
var r = new Relation(memberId, contentId, relType);
rs.Save(r);
Relation after creating node
I'm kind of new to the relationservice and how it works, but awesome feature so far. I'm still trying to figure out one simple thing, is it only possible to "create" a relation when copying a node?
Context: Site with two languages i'm connecting so when you switch from one to another, it switches to the respective node/page in the other language.
I'm trying to connect / set relation on two nodes, after I've created them, but don't think it's possible?
Hi Tobias
You can create relations programatically yourself.
See the documentation here https://our.umbraco.com/documentation/reference/management/services/relationservice/
There is an example of creating a relation in that, regarding favourites.
Cheers
Paul
Was more looking for a way to do it from the backoffice, like manually setting a relation to a selected node.
But appreciate the answer :)
Hi Tobias,
on Umbraco 7 - the "linked pages" package lets you control the relations between pages/
https://our.umbraco.com/packages/backoffice-extensions/linked-pages/
haven't release the v8 one yet, but its in the works.
Nice one! I'll definitely give it a look :)
is working on a reply...