Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Microsoft Dynamics GP (Archived)

GP13 VSTools SOP Entry Line Modifications - Advice Needed

(0) ShareShare
ReportReport
Posted on by 959

I've been asked to apply a SOP Line Item markdown on our Sales Transaction Entry Window.

I decide to have a go at using the VSTools for GP2013 to see if I can achieve this using C# rather than good old VBA. It's been a bit of a learning curve given the lack of useful documentation and samples but I have made some progress.

Using the following code I'm able to introduce a sop line markdown when the user leaves the entry line.

SOPEntryWindow.LineScroll.LineChangeAfterOriginal += new EventHandler(LineScroll_LineChangeAfterOriginal); SOPEntryWindow.LineScroll.LocalMarkdownAmount.Value = 4.95M;

The problem I have is that I won't know until all the line items have been entered if the markdown should be applied to all the lines entered. I've tried using the following script to activate a particular line but have been unable to make any progress.

GPForms.Forms.SopEntry.Functions.GetLineItemSequenceReturn.Invoke(1, GPForms.Forms.SopEntry.SopEntry.SopTypeDatabase.Value , GPForms.Forms.SopEntry.SopEntry.SopNumber.Value, 0, MyLineItemSeqNo , GPForms.Forms.SopEntry.Tables.SopLineWork);  

Q. Is it possible to go back and revisit the Markdown value for each SOPLINE entered by the user?

PS. What is the difference between LineScroll.MarkdownAmount and LineScroll.LocalMarkdownAmount?

 

Many thanks for any assistance provided

Steve

*This post is locked for comments

  • Steve Le Monnier Profile Picture
    959 on at
    RE: GP13 VSTools SOP Entry Line Modifications - Advice Needed

    Hi Som

    Thanks for your time. You're right it needs to be a two-pronged attack. Keep checking the total quantity and as soon as the invoice qualifies update the line your on with the linescroll technique. This will ensure the sop10102 disb table is created for some of the lines. and then on document save I'll have to update the totals via SQL SPROC.

    Just a shame the tools get you within touching distance but no more. Being able to walk the grid must be a top priority if the SDK is going to be of any use.

    Cheers

    Steve

  • Verified answer
    soma Profile Picture
    24,410 on at
    RE: GP13 VSTools SOP Entry Line Modifications - Advice Needed

    Not I got it clearly what you are expecting.

    For your case, you need to write a trigger to "Save button/Save Record" before original and validate the customer total quantity volume (from SOP line table), then you need to update markdown and recalculate the line extended pricing and subtotal in backend(Front it is difficult). But, you need to check many fields like (Extended Price, originating extended pricing, subtotal, etc.,,).

    Please analyze the SOP header and line table and update the markdown value with appropriate fields.

    Hope this helps!!

  • Steve Le Monnier Profile Picture
    959 on at
    RE: GP13 VSTools SOP Entry Line Modifications - Advice Needed

    This is helpful and moves me a little bit further in understanding what is going on behind the code.

    However!!!

    I cannot use LineScroll I wish I could as the job would have been finished days ago.

    The client only wants to apply a markdown when the customers *total Quantity volume* exceeds a certain amount. So if the last line qualifies for a discount I can use your method and have done so successfully.

    BUT I also need to apply the markdown to the proceeding lines and that’s where I’m struggling. I cannot revisit and get focus to each line in the grid to apply your suggestion. Using the SOP ENTRY LINE table updates the screen and DB but does not recalculate the document.

    Can I call "run script localmarkdown"). On demand?

    Steve

  • Suggested answer
    soma Profile Picture
    24,410 on at
    RE: GP13 VSTools SOP Entry Line Modifications - Advice Needed

    Steve,

    I have done this many times on Dexterity. But, I didn't do that in  VSTools. I think the logic you have used is on the below code should work.

    1. Assign the markdown amount to local markdown field( this is the user input field used for SOP line window).

    2. Run the field change script (In dexterity we are using "run script localmarkdown"). I think ForceValidate() is used run the field event in VSTools field change script.

    SOPEntryWindow.LineScroll.LocalMarkdownAmount.Value = 25.00M;

    SOPEntryWindow.LineScroll.LocalMarkdownAmount.ForceValidate();

    Call this coding before line change event.

    Note: No need to assign values to Markdown and Originating markdown field. These are all table fields. LocalMarkdown is the window. field.

    Hope this helps!!!

  • Steve Le Monnier Profile Picture
    959 on at
    RE: GP13 VSTools SOP Entry Line Modifications - Advice Needed

    Why is VS Tools So frustrating?

    I've discovered I can access the SOP Line work tables and add my markdowns directly into the table which shows up on the form and is written to the database.

    Job Done?.... NO!

    Updating the tables does not cause the verification process to fire that recalculates the document totals or writes the correct distribution lines needed for markdowns.

    Does anybody know how I can trigger these in GP so I don't have to try and create a disb line in the SOP10102 by hand?

    Steve

  • Steve Le Monnier Profile Picture
    959 on at
    RE: GP13 VSTools SOP Entry Line Modifications - Advice Needed

    Hi Som

    I'm already using "LineScroll_LineChangeBeforeOriginal" as this allows me to change the markdown and original markdown amount prior to it being recorded in the SOP10200. By using the LineChangeBefore event it also ensures that the distributions (for that line at least) are also correct as a markdown distribution account is needed.

    From your suggestion I don't think it works as the other document totals would not be correct, but also I would need to get back through the proceeding SOP Lines and correct them.

    My current thoughts on the matter are:

    1. Use VS Tools "LineScroll_LineChangeBefore" to check each line before it is written to the DB to see if a markdown is now valid.

    2. If markdown valid allow VS Tools to update that particular line. This will ensure subtables like SOP10102 are created with a markdown distribution transaction.

    3. Because I will know preceding lines have been entered that need a retrospective markdown applying I can do this by waiting until the SOP document is about to be saved/posted and use SQL SPROC to recalculate the totals.

    The only think wrong with this approach is the user will not know the value of the invoice unless the call it up again. Is there a way I can manipulate the invoice and have it reloaded on screen so the final totals are visible to the user?

    Many thanks

    Steve

  • soma Profile Picture
    24,410 on at
    RE: GP13 VSTools SOP Entry Line Modifications - Advice Needed

    I think better you can do this on dexteriy easily.

    Otherwise you can use SQL statement to update the markdown values to particular lines items/all line items with using following code.

    Register line item change event:

    SOPEntryWindow.LineScroll.LineChangeAfterOriginal += new EventHandler(LineScroll_LineChangeAfterOriginal);

    Then use the SQL script below within "LineScroll_LineChangeAfterOriginal' function and update the Markdown amount values.

    UPDATE SOP10200 SET MRKDNAMT = 4.95 WHERE SOPTYPE = 2 AND SOPNUMBE = 'ORDST2235' AND LNITMSEQ = 16384

    Note: You can get (SOPTYPE, SOPNUMBE & LNITMSEQ) these values from SOP window and use these to SQL update script parameters.

    Hope this helps!!!

  • Steve Le Monnier Profile Picture
    959 on at
    RE: GP13 VSTools SOP Entry Line Modifications - Advice Needed

    Further information on my quest to apply a retrospective markdown on line items.

    I've now been able to update the various markdown fields and ensure they are written back to the database correctly by GP using the following commands:

    SOPEntryWindow.LineScroll.LocalMarkdownAmount.Value = 25.00M;

    SOPEntryWindow.LineScroll.MarkdownAmount.Value = 25.00M;

    SOPEntryWindow.LineScroll.OriginatingMarkdownAmount.Value = 25.00M;

    SOPEntryWindow.LineScroll.LocalMarkdownAmount.RunValidate();

    SOPEntryWindow.LineScroll.MarkdownAmount.RunValidate();

    SOPEntryWindow.LineScroll.OriginatingMarkdownAmount.RunValidate();

    This sorts out the last line in the grid but I still have the issue of revisiting the other lines in the grid, as it's only by totalling all the quantities do I know I want to apply a markdown to all items. Its a bit like quantity breaks but across multiple items.

    Steve

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 > 🔒一 Microsoft Dynamics GP (Archived)

#1
Almas Mahfooz Profile Picture

Almas Mahfooz 3 User Group Leader

Featured topics

Product updates

Dynamics 365 release plans