PL 400 Plugin Development 4 — Questions and Answers
Question 1: A plugin must update related records without triggering its own registered step again. What technique prevents an infinite loop?
- Use a different IOrganizationService user context
- Check context.Depth and exit if greater than 1 (Correct answer)
- Register the step with Execution Mode set to Asynchronous
- Set the plugin's filter attributes to exclude the looping field
Correct answer: Check context.Depth and exit if greater than 1
Checking context.Depth > 1 allows the plugin to detect recursive calls and exit early, breaking the loop.
Question 2: What is the correct way to retrieve the IOrganizationService instance inside a plugin's Execute method?
- new OrganizationService(context.OrganizationId)
- serviceProvider.GetService(typeof(IOrganizationServiceFactory)) then CreateOrganizationService (Correct answer)
- context.GetOrganizationService()
- OrganizationServiceFactory.Instance.Create()
Correct answer: serviceProvider.GetService(typeof(IOrganizationServiceFactory)) then CreateOrganizationService
You resolve IOrganizationServiceFactory from the IServiceProvider, then call CreateOrganizationService(context.UserId) to get a correctly scoped service.
Question 3: Which attribute on an entity image registration controls which fields are included in the snapshot?
- FilterAttributes
- ImageAttributes (Correct answer)
- EntityAlias
- EntityImageName
Correct answer: ImageAttributes
ImageAttributes specifies the comma-separated list of logical field names included in the pre/post image snapshot.
Question 4: A plug-in developer uses context.SharedVariables to pass data between two plugins in the same pipeline execution. What is the correct data type for values stored there?
- Any serializable .NET object
- Only string values
- Only primitive types (int, bool, string, DateTime, Guid) (Correct answer)
- Only Entity or EntityReference objects
Correct answer: Only primitive types (int, bool, string, DateTime, Guid)
SharedVariables is a ParameterCollection that only supports primitive types supported by the Dataverse serialization layer.
Question 5: When a plugin is registered on the Associate message, which entity is represented in context.InputParameters['Target']?
- The primary entity of the N:N relationship
- An EntityReferenceCollection containing both related records
- A Relationship object describing the relationship schema
- An EntityReference pointing to the target entity (Correct answer)
Correct answer: An EntityReference pointing to the target entity
For the Associate message, Target is an EntityReference for the primary record, and RelatedEntities holds the associated records.
Question 6: Which Power Platform tool provides a command-line interface to register and update plugin assemblies without using the GUI Plugin Registration Tool?
- pac plugin push (Correct answer)
- xrmtoolbox deploy
- dotnet dataverse publish
- msbuild /t:DeployPlugin
Correct answer: pac plugin push
The Power Platform CLI command 'pac plugin push' automates plugin assembly registration directly from the terminal.
Question 7: A developer registers a plugin on the Create message of the Account entity with Filter Attributes set to 'name,accountnumber'. When will the plugin fire?
- Only when both name and accountnumber are included in the Create payload
- Whenever an Account is created, regardless of which fields are set
- Only when name OR accountnumber changes on an existing record
- Filter Attributes are ignored on Create; they only apply to Update (Correct answer)
Correct answer: Filter Attributes are ignored on Create; they only apply to Update
Filter Attributes are only evaluated for Update messages; on Create, the plugin fires for every create regardless of filter settings.
A plugin must update related records without triggering its own registered step again.
What technique prevents an infinite loop?