Skip to main content

Notifications

Announcements

No record found.

Customer experience | Sales, Customer Insights,...
Suggested answer

Set User Content Settings in Customer Journey

Posted on by 210

Hello,

How to configure the display of content parameters associated with the user's division in the customer journey?

pastedimage1614893876552v1.png

Thank you for your help.

Regards.

Fa

  • Fatouma  Profile Picture
    Fatouma 210 on at
    RE: Set User Content Settings in Customer Journey

    Hi,

    Thank you Clofy :)

    I will get back to you as soon as I can test.

    Regards.

    Fa

  • cloflyMao Profile Picture
    cloflyMao 25,198 on at
    RE: Set User Content Settings in Customer Journey

    Hi Fa,

    Please let me know whether the solution could make sense for you. :)

  • Suggested answer
    sbtron Profile Picture
    sbtron on at
    RE: Set User Content Settings in Customer Journey

    Hey Fa

    Please see response by Clofly and let us know if you have any other questions.

    Thanks

  • cloflyMao Profile Picture
    cloflyMao 25,198 on at
    RE: Set User Content Settings in Customer Journey

    Hi Fa,

    Does "user's division" refer to business unit of the current user?

    If so, it could be done with custom JavaScript function.

    1. Open a content settings record to get its GUID.

    pastedimage1614929053248v1.png

    2. In Customization page(Advanced Settings > Customizations), create a JScript web resource and add code below to its content.

    With this sample code, if business unit name of the current user is equal to 'CloflyBU', then set the Content settings field of the customer journey to a specific one.

    function setDefault(executionContext) {
    
        // Get current user ID
        var userSettings = Xrm.Utility.getGlobalContext().userSettings;
        var userid = userSettings.userId.replace(/[{()}]/g, '');
        console.log(userid);
    
        // Retrieve business unit of the current user
        Xrm.WebApi.retrieveRecord("systemuser", userid, "?$select=_businessunitid_value").then(
            function success(result) {
                var businessUnitName = result["_businessunitid_value@OData.Community.Display.V1.FormattedValue"];
                if (businessUnitName === 'cloflyBU') {
    
                    var contentSettings1 = new Array();
    
                    contentSettings1[0] = new Object();
    
                    contentSettings1[0].id = '73c8f2d1-b43a-eb11-a813-000d3a80c481';
    
                    contentSettings1[0].name = 'My Content Settings';
    
                    contentSettings1[0].entityType = "msdyncrm_contentsettings";
    
                    var formContext = executionContext.getFormContext();
    
                    formContext.getAttribute("msdyncrm_contentsettingsid").setValue(contentSettings1);
    
                }
            },
            function (error) {
                console.log(error.message);
            }
        );
    
    }

    3. Insert the web resource to Customer Journey > Information form, then enable our custom function at OnLoad event of the form.

    2654.z1.JPG

    1462.z2.JPG

    Save and publish the form to check whether the code works.

    pastedimage1614930283882v2.png

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,280 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,235 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans