Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Microsoft Dynamics NAV (Archived)

CONFIRM do this else exit

(0) ShareShare
ReportReport
Posted on by

When this runs and the user selects Yes the code doesn't actually execute. How can i re write this to allow it to run if the user selects yes and exits if the user selects no from the CONFIRM box? 

Thanks 8117.16.PNG

*This post is locked for comments

  • Suggested answer
    RockwithNav Profile Picture
    7,059 on at
    RE: CONFIRM do this else exit

    Hey Lewish,

    You should write

    If NOT CONFIRM('Are you Sure',TRUE) THEN

    EXIT;

    So that if the users select YES then your next piece of code get's executed.

  • Verified answer
    Community Member Profile Picture
    on at
    RE: CONFIRM do this else exit

    Only Add "not" before the "confirm".

  • mmv Profile Picture
    11,469 on at
    RE: CONFIRM do this else exit

    Hi,

    Were you able to do it?

  • Verified answer
    Binesh Profile Picture
    7,885 on at
    RE: CONFIRM do this else exit

    Hello Lewishhh,

    You have to change just couple of lines, see the bellow screenshot.

    response.png

  • Verified answer
    keoma Profile Picture
    32,727 on at
    RE: CONFIRM do this else exit

    Write

    IF NOT CONFIRM('Are you sure?',false) THEN

     exit

    Else

    ... // your code to Run

  • Verified answer
    Nareshwar Raju Vaneshwar Profile Picture
    5,596 on at
    RE: CONFIRM do this else exit

    Hi,

    Your code should work. But I rewrote your code. Just try this.

    *******

    IF recSerialNoInformation.COUNT <> recSalesShipnentline.Quantity THEN

    BEGIN

     IF CONFIRM('Are you sure?',TRUE) THEN // Parameter is set to TRUE

     BEGIN

       IF recSerialNoInformation.FINDSET(FALSE,FALSE) THEN

       BEGIN

         REPEAT

           recSerialNoInformation2 := recSerialNoInformation;

           recSerialNoInformation2."Shipment No." := recSalesShipmentLine."Document No.";

           recSerialNoInformation2."Shipment Line No." := recSalesShipmentLine."Line No";

           recSerialNoInformation2."Batch No." := '';

           recSerialNoInformation2.MODIFY;

         UNTIL recSerialNoInformation.NEXT = 0;

       END;

       recWhseSerialBatchheader.CALCFIELDS(Quantity);

       IF recWhseSerialBatchheader.Quantity = 0 THEN

         recWhseSerialBatchheader.DELETE;

     END

     ELSE EXIT; // Exit code

    END;

    Hope it helps.

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

Jainam Kothari – Community Spotlight

We are honored to recognize Jainam Kothari as our June 2025 Community…

Congratulations to the May Top 10 Community Leaders!

These are the community rock stars!

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

Leaderboard >

Featured topics

Product updates

Dynamics 365 release plans