Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Suggested answer

Disable PO number entry on Purchase Order screen screen using C#

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

I want to prevent the entry of the PO number on the Purchase Order Entry screen using C#.  I thought this would be sufficient:

PopPoEntryWindow.PoNumber.Lock();  after capturing the event  PopPoEntryWindow.PoType.LeaveAfterOriginal += new EventHandler(POPEntry_Open);

This correctly disables the entry of the PO number however GP comes up with not the next PO number but a PO number that appears as if GP is trying to fill a gap.

What is the correct combination of events to capture to simply make the PO number non-editable but still have it get the next PO number from the PO Setup table?

Categories:
  • David Musgrave MVP GPUG All Star Legend Moderator Profile Picture
    David Musgrave MVP ... 13,965 Most Valuable Professional on at
    RE: Disable PO number entry on Purchase Order screen screen using C#

    Craig Fuller  GP Power Tools does use custom scripts and triggers, but they are all defined as data stored in the SQL database.  So as long as GPPT is installed on all workstations and servers, once a change is saved, it is deployed to all workstations.

    GP Power Tools uses Dexterity triggers and scripts, but can call SQL, C# and VB.Net scripts. It does not need any external development tools and it can work with Modifier added fields. It also works on the web client (unlike VBA).

    For lots of very cool sample projects see: http://winthropdc.com/GPPT/Samples

    Including the Must Have free samples: Customer, Vendor and Item change tracking and SQL Search Lookups.

  • Richard Wheeler Profile Picture
    Richard Wheeler 75,788 Moderator on at
    RE: Disable PO number entry on Purchase Order screen screen using C#

    You could use GP Forms Modifier if you are licensed for the GP Customization site license.

  • Suggested answer
    Craig Fuller Profile Picture
    Craig Fuller 411 on at
    RE: Disable PO number entry on Purchase Order screen screen using C#

    Yes...using C#.Net, VB.Net or Dexterity.

    An exception may be if you own GP Power Tools that David Musgrave created but he would need to answer that. I believe that tool requires no custom code and no deployment when configured properly.

  • Syrus Profile Picture
    Syrus 4,156 on at
    RE: Disable PO number entry on Purchase Order screen screen using C#

    So, does that mean the disabling PO numbering and Date Filed would require Customization?

  • Suggested answer
    David Musgrave MVP GPUG All Star Legend Moderator Profile Picture
    David Musgrave MVP ... 13,965 Most Valuable Professional on at
    RE: Disable PO number entry on Purchase Order screen screen using C#

    I agree with Craig.

    You just need to move the focus off the field and it should force the code behind to run. The code already has the dexterity force changes command applied that will run the change script even if the field is not changed. This is how defaulting of transaction numbers works.

    You should not lock the field yourself as it will be locked by the original script which is also how you know that the script did run correctly.

    Regards

    David

  • Richard Wheeler Profile Picture
    Richard Wheeler 75,788 Moderator on at
    RE: Disable PO number entry on Purchase Order screen screen using C#

    Thanks, I was confirming what I thought your code snippet did.

  • Suggested answer
    Craig Fuller Profile Picture
    Craig Fuller 411 on at
    RE: Disable PO number entry on Purchase Order screen screen using C#

    With the code I provided (even without the lock) if they land on that field it will natively lock when the focus immediately moves to the buyer id. There is no opportunity for them to enter a number.

  • Richard Wheeler Profile Picture
    Richard Wheeler 75,788 Moderator on at
    RE: Disable PO number entry on Purchase Order screen screen using C#

    In this case I do not want the user landing on the PO number field. If they do need to land on it I want it to be non-editable.

    My  first challenge here is to get GP to stop trying to fill in any gaps in the PO number sequence. I am hoping that the PSTL Minimum PO/Receipt number does the trick. I will also need to insure that this PSTL tool does not interfere with my eConnect PO imports.

  • Suggested answer
    RE: Disable PO number entry on Purchase Order screen screen using C#

    I looked some but didn't find any scripts that we have for this type of process, just commands in VS Tools guide as well as Dexterity guides that could potentially disable a field so the users couldn't make changes to, in this case the PO number.

    I'll keep looking to see if I can find anything used via C#/VS Tools.

    I imagine someone in the Community will have something they can share, as usual......

    Thanks

  • Suggested answer
    Craig Fuller Profile Picture
    Craig Fuller 411 on at
    RE: Disable PO number entry on Purchase Order screen screen using C#

    Are you wanting users to be able to key in a PO number? If not, I would use PO Number Enter After original and move the focus to the buyer id after that event:

    public static void PoNumber_EnterAfterOriginal(object sender, EventArgs e)
    {
    PurchaseOrderEntryWindow.PoNumber.Lock();
    PurchaseOrderEntryWindow.BuyerId.Focus();
    }

    Actually, you may not need the Lock()...rather in the event just move the focus to the buyerid.

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

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Vahid Ghafarpour – Community Spotlight

We are excited to recognize Vahid Ghafarpour as our February 2025 Community…

Tip: Become a User Group leader!

Join the ranks of valued community UG leaders

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 292,516 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 231,375 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans