cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
bipinshan
Super User
Super User

Real world usage of Prevalidation plugin

Hello experts,

 

I am looking for a real world use case of using Pre-validation plugin.

 

I know below things about pre-validation plugin from docs page but I would like to know more about this plugin usage -

1. Runs outside the database transaction

2. Executes before security role check

3. First stage in the plugin execution pipeline.

 

Thanks,

Bipin

2 ACCEPTED SOLUTIONS

Accepted Solutions

Hello @bipinshan,

 

But this is not a Real time use case, its a Reference in the Relationship. Not sure what you are expecting dude. Because the Initial Question is - What is the Use of PREVALIDATION Plugin.

 

To Answer your Question, If you want to Perform such Kind of Operation, USE RESTRICT DELETE if CHILD RECORDS available, user can manually reassign the records and proceed further.

 

Please mark as Answer if it is helpful and provide Kudos

 

Subscribehttps://www.youtube.com/channel/UCnGNN3hdlKBOr6PXotskNLA

Blog : https://microsoftcrmtechie.blogspot.com

View solution in original post

Hello,

 

I have registered my plugin on Pre-validation stage and I was able to retrieve child records and perform calculations.

 

Thanks,

Bipin

View solution in original post

7 REPLIES 7
rampprakash
Super User
Super User

Hello @bipinshan,

 

PreValidation will only trigger in Stage Number : 10 and It will Run only in SYNC mode.

 

Please mark as Answer if it is helpful and provide Kudos

 

Subscribehttps://www.youtube.com/channel/UCnGNN3hdlKBOr6PXotskNLA

Blog : https://microsoftcrmtechie.blogspot.com

bipinshan
Super User
Super User

Hi @rampprakash ,

 

really appreciate your response.

 

I am looking for a real project use case of adding the code on this stage.

 

One thing which I know is - When you create any record in this stage and subsequent plugin stages failes the records created in pre-validation stage will not be rolled back and it will still be present in the system.

 

Thanks,

Bipin

Hello @bipinshan,

 

That depends on the Use Case 🙂 and i didn't tried your scinario 🙂 Lets wait for others comments too

 

Please mark as Answer if it is helpful and provide Kudos

 

Subscribehttps://www.youtube.com/channel/UCnGNN3hdlKBOr6PXotskNLA

Blog : https://microsoftcrmtechie.blogspot.com

bipinshan
Super User
Super User

Hi @rampprakash ,

 

I found below interesting article which talks about usage of Pre-validation plugin

https://nishantrana.me/2018/11/05/plugin-on-pre-validation-stage-in-dynamics-365-ce/

 

Question - If I delete account record and requirement is to perform some logic based on related child records of account which has relationship behaviour set to cascade All, where do I need to register my plugin ?

I know post operation plugin will not have any details of related record, those will already be deleted from the system.

 

I want to know if I can register on Pre-operation?

 

Thanks,

Bipin

Hello @bipinshan,

 

But this is not a Real time use case, its a Reference in the Relationship. Not sure what you are expecting dude. Because the Initial Question is - What is the Use of PREVALIDATION Plugin.

 

To Answer your Question, If you want to Perform such Kind of Operation, USE RESTRICT DELETE if CHILD RECORDS available, user can manually reassign the records and proceed further.

 

Please mark as Answer if it is helpful and provide Kudos

 

Subscribehttps://www.youtube.com/channel/UCnGNN3hdlKBOr6PXotskNLA

Blog : https://microsoftcrmtechie.blogspot.com

bipinshan
Super User
Super User

Hi @rampprakash ,

 

Thanks for your reply.

 

I can not use Restrict Delete in my case. I want my child records to be deleted from teh system when parent record is deleted. But I would also like to perform some logic to deduct values from another field from child records.

 

How can we achieve this?

 

I tried registering plugin on Pre-operation but when we retrieve child records from plugin it returns zero record.

 

I will try registering in Pre-validation stage and let  you know my findings.

 

Thanks,

Bipin

Hello,

 

I have registered my plugin on Pre-validation stage and I was able to retrieve child records and perform calculations.

 

Thanks,

Bipin

Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

May UG Leader Call Carousel 768x460.png

June User Group Leader Call

Join us on June 28 for our monthly User Group leader call!

PA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.

PA.JPG

New Release Planning Portal (Preview)

Check out our new release planning portal, an interactive way to plan and prepare for upcoming features in Power Platform.

Users online (2,066)