Customer Engagement & Dynamics CRM Forum

 View Only

D365 Field Services - Javascript to override save and close process

  • 1.  D365 Field Services - Javascript to override save and close process

    Posted Aug 09, 2022 04:53 PM
    Hi,

    I've added some Java Script to the Bookable Resource Bookings On Save event.  Within the code I am performing validation on the booking to prevent duplicate bookings for a tech/day, etc.  If the user receives one of my errors I would like the bookings window to stay open until they correct their data.  The problem I'm running into is when the user presses the "Save and Close" menu button, the system still performs the validation and throws the error, but it closes the booking form instead of leaving it open.  How do I override the "Save and Close" process and keep the bookings form open instead of closing it?

    I've tried the following, none of which have worked:
    executionContext.getEventArgs().preventDefault();
    executionContext.returnValue = false;
    return false;

    Thanks,
    John

    ------------------------------
    John Phillips
    Musco Lighting, Inc.
    Oskaloosa
    ------------------------------


If you've found this thread useful, dive deeper into User Group community content by role