web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

No record found.

News and Announcements icon
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

I have the same question (0)
  • Verified answer
    cloflyMao Profile Picture
    25,210 on at

    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

  • Elly-Farokhi Profile Picture
    205 on at

    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.

  • cloflyMao Profile Picture
    25,210 on at

    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

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Meet the Microsoft Dynamics 365 Contact Center Champions

We are thrilled to have these Champions in our Community!

Congratulations to the March Top 10 Community Leaders

These are the community rock stars!

Leaderboard > Customer experience | Sales, Customer Insights, CRM

#1
ManoVerse Profile Picture

ManoVerse 192 Super User 2026 Season 1

#2
11manish Profile Picture

11manish 129

#3
CU11031447-0 Profile Picture

CU11031447-0 100

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans