3

enter image description here

We are currently upgrading a site from 8X to 10.2. We are trying to change the dynamic placeholders as per 10.2. But 8.2 dynamic placeholders are of format-

/a/b_1/c_1, /a/b_1/c_2, /a/b_2/c_3.

We found that when manually adding rendering to dynamic placeholder in 10.2, the placeholder format is /a/b-{UID-a}-0/c-{UID-b}-0. How to find the UID of a or b either in Powershell or C# if more than one "a" or "b" is present in Final Rendering XML? Please refer above snippet of our 8.2 placeholder pattern

1
  • can you please add some screenshots of your presentation how it looks like? Commented Nov 21, 2022 at 10:22

1 Answer 1

0

Go through utility: https://github.com/rishishekhawat/FixDynamicPlaceholders , i hope it should help you.

enter image description here

Here you can utilize the code, you can see highlighted area, it is not dependent on old UID, for reference giving code below as well:

 foreach (RenderingDefinition rendering in device.Renderings)
                {
                    if (!string.IsNullOrWhiteSpace(rendering.Placeholder))
                    {
                        var newPlaceholder = rendering.Placeholder;
                        foreach (Match match in Regex.Matches(newPlaceholder, PlaceholderRegex, RegexOptions.IgnoreCase))
                        {
                            var renderingId = match.Value;
                            var newRenderingId = "-{" + renderingId.ToUpper().Substring(1) + "}-0";

                            newPlaceholder = newPlaceholder.Replace(match.Value, newRenderingId);

                            requiresUpdate = true;
                        }

                        result.Add(new KeyValuePair<string, string>(rendering.Placeholder, newPlaceholder));
                        rendering.Placeholder = newPlaceholder;
                    }
                }

Hope it will help...

3
  • Thanks for the answer but in Github codes are converting from pattern /a/b_UID to /a/b-{UID}-0. But my 8X placeholders are in format /a/b_1, /a/b_2
    – Sylesh JL
    Commented Nov 21, 2022 at 6:17
  • 3
    Currently while this does provide an answer to the question, it is a link only answer. When someone goes on Stack Exchange, the question "answer" should actually contain an answer. Not just a bunch of directions towards the answer. Please see this meta post for details on how to update your answer to be Stack Exchange friendly, thanks: meta.stackexchange.com/questions/8231/…
    – Marek Musielak
    Commented Nov 21, 2022 at 7:56
  • 2
    Updated the answer with some details...
    – Rinku Jain
    Commented Nov 21, 2022 at 9:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.