Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Jonathan Crosby 12 posts 33 karma points
    Feb 04, 2014 @ 23:57
    Jonathan Crosby
    0

    RelationService problem

    Hi there

    I've finally migrated from 6.0.5 to 7.0.3 and all works so far except my Relations.

    The following MarcoScript code I use and cannot get it to work in Umbraco 7:

        RelationType relationType = RelationType.GetByAlias("relateDocumentOnCopy");
        Relation[] relations = Relation.GetRelations(Model.Id, relationType);

                foreach(Relation relation in relations)
                {
                    int relationId = relation.Parent.Id;
                    if(relationId == Model.Id)
                    {
                        relationId = relation.Child.Id;
                    }
                    var TopLangPage = Model.NodeById(relationId).AncestorOrSelf(1);
               
                    if(curLanguage == TopLangPage.Language)
                    {
                        curUrl = Model.NodeById(relationId).Url;
                    }
                }

     

    Any help would be much appreciated.

  • Jonathan Crosby 12 posts 33 karma points
    Feb 23, 2014 @ 18:37
    Jonathan Crosby
    0

    Hi there

    Anyone out there who can help on this? I understand that this has been replaced by the RelationService, however the documentaton on this doesn't have many examples and I don't see a function to get the relations by Model.Id and RelationType.

    This change is stopping my language picker from working, please can someone help!

    Kind regards
    Jonathan

  • David Brendel 792 posts 2970 karma points MVP 3x c-trib
    Feb 24, 2014 @ 15:55
    David Brendel
    0

    Have the doubt that something with the relations is wrong in v7.

    Tryied to migrate a package from v6 to v7 and also the relations are not working.

    I'm using the new RelationsService in my case.

Please Sign in or register to post replies

Write your reply to:

Draft