web
You’re offline. This is a read only version of the page.
close
Skip to main content
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
    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

  • Elly-Farokhi Profile Picture
    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.

  • cloflyMao Profile Picture
    25,210 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

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Abhilash Warrier – Community Spotlight

We are honored to recognize Abhilash Warrier as our Community Spotlight honoree for…

Leaderboard > Customer experience | Sales, Customer Insights, CRM

#1
Rishabh Kanaskar Profile Picture

Rishabh Kanaskar 247

#2
Tom_Gioielli Profile Picture

Tom_Gioielli 166 Super User 2025 Season 2

#3
MVP-Daniyal Khaleel Profile Picture

MVP-Daniyal Khaleel 164

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans