Exam PL-400 All QuestionsBrowse all questions from this exam
Question 241

HOTSPOT -

A manufacturing company takes online orders.

The company requires automatic validation of order changes. Requirements are as follows:

✑ If validation is successful, the order changes must be submitted.

✑ If exceptions are encountered, a message must be shown to the customer and the order changes must not be submitted.

You need to set up and deploy a plug-in that encapsulates the rules.

Which options should you use? To answer, select the appropriate options in the answer area.

NOTE: Each correct selection is worth one point.

Hot Area:

    Correct Answer:

    Box 1: PreValidation -

    PreValidation: For the initial operation, this stage will occur before the main system operation.

    This provides an opportunity to include logic to cancel the operation before the database transaction.

    Box 2: Synchronous -

    Ideally, you should only cancel operations using synchronous plug-ins registered in the PreValidation stage.

    Box 3: Pre Image -

    Box 4: throw ..

    When you throw an InvalidPluginExecutionException exception within a synchronous plug-in an error dialog with your message will be displayed to the user.

    Reference:

    https://docs.microsoft.com/en-us/powerapps/developer/common-data-service/event-framework https://docs.microsoft.com/en-us/powerapps/developer/common-data-service/handle-exceptions

Discussion
Leila24

PreValidation stage is nor recommended for use due to security concerns. Pre Operation shall be the answer

LorneMalvo

No it shall not. As written in microsoft documentation: PreValidation - This provides an opportunity to include logic to cancel the operation before the database transaction. PreOperation - Avoid cancelling an operation here. Canceling will trigger a rollback of the transaction and have significant performance impact. See: https://docs.microsoft.com/en-us/power-apps/developer/data-platform/event-framework

NyarukouSAMA

Looks like Microsoft's recommendations have been changed, because previously Microsoft had recommended not to use PreValidation at all, except in some cases where you need to implement custom validation logic for the message.

Shradz93

Agreed! Pre validation means you plugin will run before the form is validated Pre -operation is after validation and before the values are saved to the database

At09

I dont understand why people making simple things difficult. Pre Validation it is. No more arguments

loecun

first one is correct. It's PreValidation. as per https://docs.microsoft.com/en-us/powerapps/developer/data-platform/event-framework#event-execution-pipeline, PreValidation provides an opportunity to include logic to cancel the operation, whereas for PreOperation, avoid cancelling an operation here because of performance impact.

rogrod

Sorry, but I disagree... maybe i'm wrong but... Prevalidation would be the best option to cover "If validation is sucessful...", but not for "If exceptions are encountered..". Nothing is done at this momment at the database, so we can not be sure all the update operation (entire operation) will be done.. To be sure that the update operation (and all another process, plugins, etc, etc that can be triggered on a order update) the stage would be "PostOperation": At this momment all the operations has been done and we can be sure that all the process is fine. If a exception is encountered, we can throw an exception and rollback. So in my opinion: PostOperation (we cover all possible exceptions in the operation) Synchronous (need show an error to user) PreImage (we already have the post values in "target" because we are in Post stage) Throw new Invalid.....

northstar88

The requirement is: "The company requires automatic validation of order changes.". The scope is limited to validating an order change, not the order process itself. I think prevalidation is sufficient.

Aferdita

https://www.examtopics.com/discussions/microsoft/view/25333-exam-mb-400-topic-5-question-6-discussion/

Hendrikdb

Is correct answer, use prevalidation always for validating data before going to the preoperation. Preoperation is used for data manipulation before save and postoperation when you need to upsert related data

LSgeek

correct

Kalimho

in exam 2022.07.21

BlueP

answers are correct for pre-validation vs pre-operation I'm not 100% as both could work and depending on the type of validation you might have to use pre-operation. But given how simple the question is I will go with pre-validation

CinthiaN

IMO Is correct

Big_PP

Should be post image no? So you can compare with the data you have at your disposal at execution.

S41

You need a snapshot of the entity before the operation to compare with the changes in the context of the plugin during the operation. Pre Image is correct.