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 :
Finance | Project Operations, Human Resources, ...
Suggested Answer

Dexterity hook for SOP deletion: batch and individual

(0) ShareShare
ReportReport
Posted on by 379

Hey All:

I'm spinning my wheels on this and figured I'd come here and ask a specific question, and a more general question.

Specifically, I have a Dexterity routine that I want to run on sopTrackingNumbers.  I've got the CRU of it all, but the D (from CRUD) is vexing me.  I've tried figuring out where to hook my delete routine, but everywhere I seem to be hooking into, I'm unable to get the SOP number (so I can remove the subsequent records I have tied to SOP10107.)  The customer allows deletion of SOP documents, and has it password protected.  I seem to be bouncing against the fact that I can't run my script PRE (because the password might be rejected, in which case my links have to stay linked to SOP10107), and I can't run it POST, because the document number is already gone.

I've seen that there's a place where I can hook on the tracking numbers themselves: 'DelForID of form sopTrackingNumbers'.  This is great, I can hook in on that and delete the tracking number that I want to...  but where do I get the SOP number if it's a batch delete?  I feel like a fool, honestly, because this really shouldn't be this hard!

My general question:

Where do you find the best places to link into things?  I've seen that people run profiler (thank you Tim / David for reminding me) and parse from there.  In fact that's how I found DelForID, but how do you figure out where the best place to put a TRIGGER is?  David consistently stumps me on this, and swoops in to save my day...  Which is great, thank you David!  But...  how does one learn this for themselves?

Thanks everyone!

-J

Categories:
I have the same question (0)
  • Suggested answer
    Isaac Olson Profile Picture
    Microsoft Employee on at

    Hello,

    I will leave this open to any Dexterity Developers as well, but from a SQL Standpoint, I would put a trigger on the SOP10107 that triggers when this table is deleted, then join the deleted information to your custom table to remove the data.  

    CREATE TRIGGER SOP10107DELETE

    ON SOP10107

    FOR DELETE

    AS

       SET nocount ON

       DELETE CUSTOMTABLE

       FROM   CUSTOMTABLE

              LEFT JOIN deleted

                     ON CUSTOMTABLE.SOPNUMBE = deleted.SOPNUMBE

                        AND CUSTOMTABLE.Tracking_Number = deleted.Tracking_Number

    go

    Something like this for example you could use as a starting point you would just replace your table with CUSTOMTABLE and keep the reference to deleted as it will use the SOPNUMBE and Tracking_Number that is being deleted here.  

    This obviously isn't a supported solution but is something that you could test with your customization.  

    I hope this helps!

    Isaac Olson

    Microsoft Support

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Congratulations to our 2025 Community Spotlights

Thanks to all of our 2025 Community Spotlight stars!

Leaderboard > Finance | Project Operations, Human Resources, AX, GP, SL

#1
Giorgio Bonacorsi Profile Picture

Giorgio Bonacorsi 617

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 461 Super User 2026 Season 1

#3
Syed Haris Shah Profile Picture

Syed Haris Shah 298 Super User 2026 Season 1

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans