QuestionQ278

Extend the platform

You are developing a Power Platform solution that uses a plug-in. The plug-in contains the following code, with line numbers included for reference:

Question Image

A plug-in step is registered in the execution pipeline at the PreOperation stage for the Create message.

For each of the following statements, select Yes if the statement is true. Otherwise, select No.

Yes or No
StatementsYesNo
The GenerateAccountNumber method runs if the plug-in step registration is changed to the PostOperation stage.
Creating an account in a model-driven app while excluding a name generates the error message “Account name is missing”.
The Organization service's Update method must run to update the database after setting the accountnumber value.
Explanation

Stage 20 is PreOperation and PostOperation is stage 40, so the stage guard returns before the account-number method runs when the step is moved to PostOperation. A missing name makes TryGetAttributeValue return false and raises InvalidPluginExecutionException with the stated message. Changes to the Target entity in PreOperation are saved by the same Create operation, so IOrganizationService.Update is unnecessary.

Learn more

Community Discussion

No comments yet. Be the first to start the discussion!