Copied to clipboard

Flag this post as spam?

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


  • Justin 4 posts 74 karma points
    Jan 30, 2019 @ 22:06
    Justin
    0

    How to match the alias id that is preserved in Usync with the value stored in a document type

    Greetings!

    Starting off, I'm just getting into Umbraco, so apologies if this is super obvious.

    I have a radio button that selects different presentation configurations for the screen. I can see when I add elements to the radio button, Usync creates elements in their proper location, but when I set and attempt to retrieve values, they come back not as the alias Usync has, but rather an id that was incremented (I'm guessing) from how the CMS was created document and data types in the database.

        var umbracoHelper = new Umbraco.Web.UmbracoHelper(Umbraco.Web.UmbracoContext.Current);
        Node currentNode = Node.GetCurrent();
        Node currentHomeNode = new Node(int.Parse(currentNode.Path.Split(',')[1]));
        var currentHome = umbracoHelper.TypedContent(currentHomeNode.Id);
    
        //get the document type
        var settings = currentHome.Children.First(x => x.IsDocumentType("settings"));
    
        //get the value saved on the document type
        var idValue = settings.GetProperty("ThemeSelector").Value;
    

    In this instance, IdValue is 527 instead of 3. (it's the third element in the Usync radio button)

    How do I reconcile the id that Umbraco has assigned the radio button with the underlying Usync id or alias?

  • Lee 35 posts 84 karma points
    May 14, 2019 @ 13:33
    Lee
    0

    Hey, @Justin, did you ever get this figured out? I would like to know how you reconciled the IDs.

    , Lee

  • Justin 4 posts 74 karma points
    Jun 16, 2020 @ 15:14
    Justin
    0

    Sorry this is a year late, but we resigned to string comparisons for the name, which, obviously, could screw us up if that changes. Without a better direction, we went with what.

Please Sign in or register to post replies

Write your reply to:

Draft