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

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Microsoft Dynamics GP (Archived)

GP 2010 SOP Likne Scroll Area

(0) ShareShare
ReportReport
Posted on by 75,854 Moderator

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

  • Richard Wheeler Profile Picture
    75,854 Moderator on at

    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#?

  • Dave Dusek Profile Picture
    Microsoft Employee on at

    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.  

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

Congratulations to the July Top 10 Community Leaders

These are the community rock stars!

Leaderboard > 🔒一 Microsoft Dynamics GP (Archived)

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans