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

Announcements

Community site session details

Community site session details

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

Javascript alert raised repeatdly until stage qualified in ms crm

(0) ShareShare
ReportReport
Posted on by 40

Hi,

I'm using the below code, onchange() event field in BPF. But alert is poping continuously on screen.

function DiscoveryExpirationDate(executionContext)
{
var formContext = executionContext.getFormContext();
var systemDate = new Date();
var ExpirationDate = formContext.getAttribute("aith_expirationdate").getValue();
if(ExpirationDate < systemDate)
{
alert('expiration date cannot be greater than system date');
formContext.getAttribute("aith_expirationdate").setValue(systemDate);
}
}

Any help would be appreciated.

I have the same question (0)
  • meelamri Profile Picture
    13,218 User Group Leader on at

    Hi,

    Can you please give more details about your Event Handler ? Some screenshots may help to find the source of the issue.

  • meelamri Profile Picture
    13,218 User Group Leader on at

    Hi,

    Can you please give more details about your Event Handler ? Some screenshots may help to find the source of the issue.

  • Esteban Coto Alfaro Profile Picture
    on at

    Hello, everything looks correctly in your code, so I suggest to give a little more context of the problem, could be with some screenshots of the configuration.

    Thanks!

    Community Support Team - Esteban

    If this Post helps, then please consider Accept as solution to help the other members find it more quickly.

  • Suggested answer
    Bipin D365 Profile Picture
    28,983 Moderator on at

    Hi,

    Have you tried commenting below line from your code to see if issue still persist.

    formContext.getAttribute("aith_expirationdate").setValue(systemDate);

    I see you are updating same field on which you have added event handler. It is going in loop.

    if problem is solved by comming the line of code which i mentioned then you need to check the value returned.

    Please mark my answer verified if i were helpful

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…

Congratulations to our 2025 Community Spotlights

Thanks to all of our 2025 Community Spotlight stars!

Leaderboard > Customer experience | Sales, Customer Insights, CRM

#1
Tom_Gioielli Profile Picture

Tom_Gioielli 53 Super User 2026 Season 1

#2
Eugen Podkorytov Profile Picture

Eugen Podkorytov 49

#3
Fiona_Tiernan Profile Picture

Fiona_Tiernan 22 Moderator

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans