web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

Retrieve attributes from a record with a plugin triggered on Delete record event

(0) ShareShare
ReportReport
Posted on by 152

Hello everyone,

I am implementing a plugin which get triggered on delete event from  Order Line entity. In my scenario, i created relationships between Order Lines and Product entities and between Order Line and Warehouse entities.

Once i delete the record, i would like to retrieve the value of both lookup fields from the Order Line record. One lookup field points to the Product related, and the other lookup field points to the warehouse related.

Once i get these both entity references, i update the value for a third-part entity Product Inventory based on the value of these both entity references.

The plugin is Async Post

public void Run()
{
Entity deletedSalesOrderProduct = service.Retrieve(Att.SalesOrderDetail.logicalName, entityReference.Id, Att.SalesOrderDetail.columns);

/* Other functionality */

}

By any reason, i  cannot access to the record and i have the error "The requested record was not found or you do not have sufficent permissions to view it "

Thanks in advance!

Kind regards.

*This post is locked for comments

I have the same question (0)
  • Jorge Gomez Profile Picture
    152 on at
    RE: Retrieve attributes from a record with a plugin triggered on Delete record event

    Thanks very much Vikas,

    It works now, your replies gave me the solution!

  • Verified answer
    Community Member Profile Picture
    on at
    RE: Retrieve attributes from a record with a plugin triggered on Delete record event

    You need to run your plugin before the database operation is executed. So registering it in pre operation is enough I guess.

  • Jorge Gomez Profile Picture
    152 on at
    RE: Retrieve attributes from a record with a plugin triggered on Delete record event

    Do you mean pre-operation or pre-validation?

    Kind regards.

  • Verified answer
    Community Member Profile Picture
    on at
    RE: Retrieve attributes from a record with a plugin triggered on Delete record event

    You need to register your plugin on pre event. Right now you have registered it on post event so the record does not exists in DB once deleted.

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Andrés Arias – Community Spotlight

We are honored to recognize Andrés Arias as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
Community Member Profile Picture

Community Member 2

#2
Christoph Pock Profile Picture

Christoph Pock 1

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans