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

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Customer experience | Sales, Customer Insights,...
Suggested Answer

Option Set value selected "yes" means date filed should make as mandatory field in CRM Portal.

(0) ShareShare
ReportReport
Posted on by 120

Hi Team,

I am having a Option set field(yes/No) with the values of 

Yes:101

No:102

And One more field Date field

If i am selecting yes means date field should make as a mandatory field to fill portal side.

If No means date field should make as a non mandatory field to fill portal side

like below

pastedimage1661270435920v1.png

I have the same question (0)
  • Suggested answer
    Haritha222 Profile Picture
    120 on at

    Using JQuery we can achieve this

    [quote user="Haritha222"]

    Hi Team,

    I am having a Option set field(yes/No) with the values of 

    Yes:101

    No:102

    And One more field Date field

    If i am selecting yes means date field should make as a mandatory field to fill portal side.

    If No means date field should make as a non mandatory field to fill portal side

    like below

    pastedimage1661270435920v1.png

    [/quote]
  • Inogic Profile Picture
    682 on at

    Hi Haritha,

    If you are still looking for solution, please find the below code for reference and add it into your basic form(entity form) under(Additonal settings tab) as custom javascript:

    $(document).ready(function() {

    // Add event validator

    if (typeof(Page_Validators) == 'undefined') return;

    // Create new validator

    var newValidator = document.createElement('span');

    newValidator.style.display = "none";

    newValidator.id = "new_dateofdischargeValidator";

    newValidator.controltovalidate = "new_dateofdischarge";

    newValidator.errormessage = "<a href='#new_dateofdischarge_label'>Date is a required field.</a>";

    newValidator.evaluationfunction = function() {

    if (!$('#new_previouspicuadmissionfortoday_0').is(':checked') && $('#new_previouspicuadmissionfortoday_1').is(':checked')) {

    if ($('#new_dateofdischarge').val() == "") {

    return false;

    } else {

    return true;

    }

    } else {

    return true;

    }

    };

    Page_Validators.push(newValidator);

    // Add validator element

    $("#new_previouspicuadmissionfortoday_0").change(function() {

    if (this.checked) {

    $("#new_dateofdischarge").attr('aria-required', "false");

    $('#new_dateofdischarge').parent().prev().removeClass("required");

    }

    });

    $("#new_previouspicuadmissionfortoday_1").change(function() {

    if (this.checked) {

    $("#new_dateofdischarge").attr('aria-required', "true");

    $('#new_dateofdischarge').parent().prev().addClass("required");

    }

    });

    })

    If selected value is set to “No” then date field is set to not required as shown below:

    1CRM-Portal.png

    If selected value is “Yes” date field is set to be required as shown below:

    2CRM-Portal.png

    Hope this helps.

    Thanks!

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…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > Customer experience | Sales, Customer Insights, CRM

#1
Tom_Gioielli Profile Picture

Tom_Gioielli 170 Super User 2025 Season 2

#2
#ManoVerse Profile Picture

#ManoVerse 61

#3
Gerardo Rentería García Profile Picture

Gerardo Rentería Ga... 52 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans