I was recently asked how to use GP Power Tools to prevent users from Inserting or Deleting lines from the Sales Transaction Entry (SOP_Entry) window.
It is a really simple customization so I thought I would post it as a sample for your reference.
We start as usual by creating a project to contain all the components of the customization.
Then we can create a focus event trigger before the scroll insert of the Line_Scroll window in the SOP_Entry form.
The actions are set to display a warning message in a simple dialog and to issue a Reject Script command to prevent the original GP code from running.
The script just needs to set the OUT_Condition=true to make the actions run each time the trigger is fired.
This trigger is then duplicated and adjusted to handle the Scroll Delete event to prevent deleting of a line.
The final piece of the puzzle is to prevent a line being deleted from the Sales Item Detail Entry window. We just need to add one more trigger before the Field Change event of the Delete Button on the SOP_Item_Detail window of the SOP_Item_Detail form with the same actions and script.
Finally, from the Project Setup window, you can use the Update Triggers Button to Mark All as Minimize Logs (if they are not already) and to Mark All as Automatic Start to make the code active.
Downloading and Installing
Download the example code, import using the Project Setup window (now possible for first time imports with Build 28.8 onwards), or use Configuration Export/Import window (for older builds):
The code will be active on next login or after switching companies, or you can use start them manually from the Project Setup window.
For more information see:
- GP Power Tools Portal: http://winthropdc.com/GPPT
- GP Power Tools Samples: http://winthropdc.com/GPPT/Samples
- GP Power Tools Videos: http://winthropdc.com/GPPT/Videos
This article was originally posted on http://www.winthropdc.com/blog.