Skip to main content

Notifications

Announcements

No record found.

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

Dexterity hook for SOP deletion: batch and individual

Posted on by 294

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:
  • Suggested answer
    Isaac Olson Profile Picture
    Isaac Olson on at
    RE: Dexterity hook for SOP deletion: batch and individual

    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

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

#2
Martin Dráb Profile Picture

Martin Dráb 230,214 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans