Skip to main content

Notifications

Microsoft Dynamics GP (Archived)

GP 2010 SOP Likne Scroll Area

Posted on by 75,730

I am trying to trap the event when a user changes the sell price of an item. All I want to do is capture and display a box that say "Hey dummy, you are trying to change the sell price, do you really want to be doing that???" I am using VS C# and all works well with the exception I do not want this check to occur when the user is entering a new line on the order in the Line Scroll area. What can I use in my code as an indication that this is a new line?

 

Here is my current code:

/*Register a change event for the Unit Sell Price field of the Line Scroll window on the sales transaction entry window*/

sopEntryWindow.LineScroll.LocalUnitPrice.Change +=

 

new EventHandler(CheckForLineValueChanges);

/* Check for line value change of the field LocalUnitPrice */

 

 

 

public void CheckForLineValueChanges(object sender, EventArgs e)

{

    sopEntryWindow.LineScroll.LocalUnitPrice.LeaveAfterOriginal +=

 

new EventHandler(SellPriceChangeNotification);

}

 

 

/* Notify the user that the sell price has been changed and prompt for confirmation and reason */

 

 

public void SellPriceChangeNotification(object sender, EventArgs e)

{

 

 

if (SOPCheckSellPriceForm == null)

    {

        SOPCheckSellPriceForm =

 

new frmSOPCheckSellPrice();

    }

 

 

    else

    {

 

 

    if (SOPCheckSellPriceForm.Created == false)

    {

        SOPCheckSellPriceForm =

 

new frmSOPCheckSellPrice(LocalUnitSellPrice,UnitSellPrice);

    }

}

 

 

/* Display notificaction that user has changed sell price */

SOPCheckSellPriceForm.Show();

SOPCheckSellPriceForm.Activate();

}

 

 

 

public void CheckForLineValueChanges(object sender, EventArgs e)

{

    sopEntryWindow.LineScroll.LocalUnitPrice.LeaveAfterOriginal +=

 

new EventHandler(SellPriceChangeNotification);

}

 

 

/* Notify the user that the sell price has been changed and prompt for confirmation and reason */

 

 

public void SellPriceChangeNotification(object sender, EventArgs e)

{

 

 

if (SOPCheckSellPriceForm == null)

    {

        SOPCheckSellPriceForm =

 

new frmSOPCheckSellPrice();

    }

 

 

    else

    {

 

 

    if (SOPCheckSellPriceForm.Created == false)

    {

        SOPCheckSellPriceForm =

 

new frmSOPCheckSellPrice(LocalUnitSellPrice,UnitSellPrice);

    }

}

 

 

/* Display notificaction that user has changed sell price */

SOPCheckSellPriceForm.Show();

SOPCheckSellPriceForm.Activate();

}

 

 

 

public void CheckForLineValueChanges(object sender, EventArgs e)

{

    sopEntryWindow.LineScroll.LocalUnitPrice.LeaveAfterOriginal +=

 

new EventHandler(SellPriceChangeNotification);

}

 

 

/* Notify the user that the sell price has been changed and prompt for confirmation and reason */

 

 

public void SellPriceChangeNotification(object sender, EventArgs e)

{

 

 

if (SOPCheckSellPriceForm == null)

    {

        SOPCheckSellPriceForm =

 

new frmSOPCheckSellPrice();

    }

 

 

    else

    {

 

 

    if (SOPCheckSellPriceForm.Created == false)

    {

        SOPCheckSellPriceForm =

 

new frmSOPCheckSellPrice(LocalUnitSellPrice,UnitSellPrice);

    }

}

 

 

/* Display notificaction that user has changed sell price */

SOPCheckSellPriceForm.Show();

SOPCheckSellPriceForm.Activate();

}

 

 

public void CheckForLineValueChanges(object sender, EventArgs e)

{

    sopEntryWindow.LineScroll.LocalUnitPrice.LeaveAfterOriginal +=

 

new EventHandler(SellPriceChangeNotification);

}

 

 

/* Notify the user that the sell price has been changed and prompt for confirmation and reason */

 

 

public void SellPriceChangeNotification(object sender, EventArgs e)

{

 

 

if (SOPCheckSellPriceForm == null)

    {

        SOPCheckSellPriceForm =

 

new frmSOPCheckSellPrice();

    }

 

 

    else

    {

 

 

    if (SOPCheckSellPriceForm.Created == false)

    {

        SOPCheckSellPriceForm =

 

new frmSOPCheckSellPrice(LocalUnitSellPrice,UnitSellPrice);

    }

}

 

 

/* Display notificaction that user has changed sell price */

SOPCheckSellPriceForm.Show();

SOPCheckSellPriceForm.Activate();

}

 

 

*This post is locked for comments

  • Dave Dusek Profile Picture
    Dave Dusek on at
    Re: GP 2010 SOP Likne Scroll Area

    Richard,  Use the ValidateBeforeOriginal or ValidateAfterOriginal events.  Those will only run if the user actually tries to change the field.  The change event is going to run whenever the field changes whether the user did it or not.  

  • Richard Wheeler Profile Picture
    Richard Wheeler 75,730 on at
    Re: GP 2010 SOP Likne Scroll Area

    OK, I think the solution is this.

    When you go to create a new line in the line scroll area, the line is not added to the SOP line table until you move to the next line. So they way to tell if it is a new line is to check to see if it exists in the SOP10200 table. If it does not, then it is a new line. Now the question is how do you do that using VS C#?

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,253 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,188 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans