Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

Show yes or No based on date value

(0) ShareShare
ReportReport
Posted on by 815

Hi,

Can anyone help if this possible to do.

There are three fields, two date fields name as Start date and end date and one text field.

User will manually fill start and end date

Condition is : 

If end date is less then 365 days from current date then it show as YES on text field

If end date is greater then 365 days from current date then it show as No on text field

For easy understanding this for warranty calculation.

Please help.

Regards

Faisal

*This post is locked for comments

  • Syed_Faisal Profile Picture
    815 on at
    RE: Show yes or No based on date value

    Sure Gowtam.

  • gdas Profile Picture
    50,091 Moderator on at
    RE: Show yes or No based on date value

    Please mark as verified my first answer as the code is correct which I shared in my first post . So that other people can use the same code.

  • Syed_Faisal Profile Picture
    815 on at
    RE: Show yes or No based on date value

    Hi Gowtham,

    Now the code is working fine, registered function onchange on the both dates, it works realtime.

    Thanks a lot.

  • Verified answer
    gdas Profile Picture
    50,091 Moderator on at
    RE: Show yes or No based on date value

    Hi Sayed ,

    In which event you registered the method , make sure you need to registered the function in the onchange of start date and end date.

    Did you tried to debug ? Try to debug and check JS code executing or not in the onchange event .

  • Syed_Faisal Profile Picture
    815 on at
    RE: Show yes or No based on date value

    Hi Gowtam,

    Warranty Status field is Text box

    Hi Ravi,

    JS name as warrantystatus.

    Just check it is working fine without error but whole page need to refresh to see the effect.

  • Suggested answer
    RaviKashyap Profile Picture
    55,410 Moderator on at
    RE: Show yes or No based on date value

    Hi Syed,

    What is the name of your javascript web resource?

  • Suggested answer
    gdas Profile Picture
    50,091 Moderator on at
    RE: Show yes or No based on date value

    Hi sayed ,

    What is the field type of warranty status ?if it is two options then replace the value  instead of yes , no it will be 0,1.

    Xrm.Page.getAttribute("new_warrantystatus").setValue(0);

  • Syed_Faisal Profile Picture
    815 on at
    RE: Show yes or No based on date value

    3162.Untitled.png

    also have updated with last code

  • Suggested answer
    gdas Profile Picture
    50,091 Moderator on at
    RE: Show yes or No based on date value

    Try with my last code which i shared.Your code is correct there is no error in this code if all field name is correct.

    Try to debug your code simply write debugger: and press F12 and try to debug , let me know which line causing error.

  • Syed_Faisal Profile Picture
    815 on at
    RE: Show yes or No based on date value

    Hi Gowtam,

    PFA all info.

    81441.Untitled.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

🌸 Community Spring Festival 2025 Challenge Winners! 🌸

Congratulations to all our community participants!

Adis Hodzic – Community Spotlight

We are honored to recognize Adis Hodzic as our May 2025 Community…

Kudos to the April Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard > Microsoft Dynamics CRM (Archived)

#1
Mohamed Amine Mahmoudi Profile Picture

Mohamed Amine Mahmoudi 83 Super User 2025 Season 1

#2
Community Member Profile Picture

Community Member 52

#3
dkrishna Profile Picture

dkrishna 6

Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans