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
Thanks very much Vikas,
It works now, your replies gave me the solution!
You need to run your plugin before the database operation is executed. So registering it in pre operation is enough I guess.
Do you mean pre-operation or pre-validation?
Kind regards.
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.
Stay up to date on forum activity by subscribing. You can also customize your in-app and email Notification settings across all subscriptions.
André Arnaud de Cal... 291,253 Super User 2024 Season 2
Martin Dráb 230,188 Most Valuable Professional
nmaenpaa 101,156