Skip to main content

Notifications

Announcements

No record found.

Finance | Project Operations, Human Resources, ...
Suggested answer

Capture leave event on an existing record in SOP Transaction Entry

Posted on by 75,730

This very nicely will capture the event of leaving the item number field on the SOP Transaction Entry screen but only for a new record. How do you capture the event when leaving the item number field on an existing record?

            SopEntryWindow.LineScroll.ItemNumber.ValidateAfterOriginal += new EventHandler(ItemNumber_Change);

Categories:
  • David Musgrave MVP GPUG All Star Legend Moderator Profile Picture
    David Musgrave MVP ... 13,926 Most Valuable Professional on at
    RE: Capture leave event on an existing record in SOP Transaction Entry

    Hi Richard

    To prevent access to the field I would use the scrolling window line pre event.

    In my script I would lock the field if the item number is not empty.

    Regards

    David

  • Richard Wheeler Profile Picture
    Richard Wheeler 75,730 on at
    RE: Capture leave event on an existing record in SOP Transaction Entry

    In this case that is fine. I really only need it to fire when someone leaves the item number field.

  • Richard Wheeler Profile Picture
    Richard Wheeler 75,730 on at
    RE: Capture leave event on an existing record in SOP Transaction Entry

    Thanks, this may prove useful.

  • Craig Fuller Profile Picture
    Craig Fuller 409 on at
    RE: Capture leave event on an existing record in SOP Transaction Entry

    You likely know this but just in case you don't and to save you some future issues, I just wanted to remind you that whatever you code in your ItemNumber_Change sub or function, that code will fire with each and every letter typed in the item number field.

  • Suggested answer
    Craig Fuller Profile Picture
    Craig Fuller 409 on at
    RE: Capture leave event on an existing record in SOP Transaction Entry

    I'm glad you have something working as you need it.

    The SopEntryWindow.DisplayExistingRecord.Value will tell you if the document is existing or a new one.

  • Richard Wheeler Profile Picture
    Richard Wheeler 75,730 on at
    RE: Capture leave event on an existing record in SOP Transaction Entry

    In this case I have an unusual case where the client wants the LOCNCODE to always be their WAREHOUSE regardless of whether the order being entered on the sales order has other locations. They do have the IV00101.ITEMTYPE set to Sales Inventory and want to prevent any user from changing the location to anything else when the type is sales inventory. There is no item type on the SOP Detail Entry screen grid. So I need to query the IV00101 table to get the item type.

  • Suggested answer
    Craig Fuller Profile Picture
    Craig Fuller 409 on at
    RE: Capture leave event on an existing record in SOP Transaction Entry

    I would use caution with the Change Events as they can fire more than once depending upon the field (sometimes with values in them and other times without). When leaving fields I stick with either LeaveBeforeOriginal or LeaveAfterOriginal depending upon whether I want the opportunity to cancel the leave and keep the user in the field until valid values are entered or not.

    Anyway, I use an If statement to check the value SopEntryWindow.DisplayExistingRecord.Value, If it's True, then it's an existing record and if False it is a new record.

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,269 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,198 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans