Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Customer experience | Sales, Customer Insights,...
Answered

subscription management logic

(0) ShareShare
ReportReport
Posted on by 205

Hello everyone, 

I have a subscription page where people can subscribe to a different marketing list or click on Unsubscribe to unsubscribe from all the emails. 

I require to grey out and lock my subscription list if someone clicks on unsubscribe.

1351.Subscription_2D00_1.JPG

Do you have a solution for that, Many Thanks 

Elly

  • cloflyMao Profile Picture
    cloflyMao 25,202 on at
    RE: subscription management logic

    Hi Elly,

    We couldn't change the color of checkbox element directly, it's limitation of browser.

    But a workaround is that we could apply CSS filter to checkbox element, the final effect is very similar to changing background color.

    1. Create a custom class with filter property inside style tag.

    pastedimage1590048282881v1.png

    .disabled-list {
        filter: invert(90%) sepia(33%) saturate(6%) hue-rotate(314deg) brightness(94%) contrast(91%);
    }

    The filter effect is similar to #ddd color.

    2. In the original function,

    add the class to subscription list checkbox elements when "unsubscribe" checkbox is checked,

    remove the class from subscription list checkbox elements when "unsubscribe" checkbox is unchecked,

    list1.classList.add("disabled-list");

    list1.classList.remove("disabled-list");

    pastedimage1590048413900v2.png

    Result from my demo:

    pastedimage1590048571521v3.png

    To get a satisfied background color, you could convert hex color to filter parameters by the website below:

    https://codepen.io/sosuke/full/Pjoqqp

    pastedimage1590048722172v4.png

    Regards,

    Clofly

  • Elly-Farokhi Profile Picture
    Elly-Farokhi 205 on at
    RE: subscription management logic

    Thank you so much Colfy, you are so amazing.

    is it possible to change the color in same time as well, I need to make it grey when locked.

  • Verified answer
    cloflyMao Profile Picture
    cloflyMao 25,202 on at
    RE: subscription management logic

    Hi Elly,

    We could achieve it by code below:(paste it inside script tag)

    MsCrmMkt.MsCrmFormLoader.on('afterFormLoad', function (event) {
    
        var unsubscribe = document.querySelectorAll("input[type=checkbox]")[3];
    
        var list1 = document.querySelectorAll("input[type=checkbox]")[0];
        var list2 = document.querySelectorAll("input[type=checkbox]")[1];
        var list3 = document.querySelectorAll("input[type=checkbox]")[2];
    
        unsubscribe.addEventListener('change', function (event) {
            if (event.target.checked) {
                list1.disabled = true;
                list2.disabled = true;
                list3.disabled = true;
            } else {
                list1.disabled = false;
                list2.disabled = false;
                list3.disabled = false;
            }
        })
    
    });

    Regards,

    Clofly

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

Daivat Vartak – Community Spotlight

We are honored to recognize Daivat Vartak as our March 2025 Community…

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Tip: Become a User Group leader!

Join the ranks of valued community UG leaders

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 292,516 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 231,407 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans