Interface ITargetItem
The ITargetItem interface is a wrapper around the Target, PreImage, and PostImage of a plugin operation.
public interface ITargetItem
Properties
Id
Primary id of the record
Guid Id { get; }
Property Value
Index
The index of this record within the bulk operation
int Index { get; }
Property Value
Input
The main target input of the plugin operation.
Entity Input { get; }
Property Value
this[string]
Get the expected value of the field after the operation checking data in the postimage, target, then preimage (if available). OR sets a value to the target input record.
object? this[string attribute] { get; set; }
Parameters
attribute
stringThe logical name of the attribute.
Property Value
- object
Value of the given attribute
ItemIdentifier
Text that can be put at the front of log or error messages indicating which record is being processed.
string ItemIdentifier { get; }
Property Value
LogicalName
The logical name of the record table
string LogicalName { get; }
Property Value
Merged
A combination of PostImage, Input (Target), and PreImage in that order that gives the latest values of the record.
Entity Merged { get; }
Property Value
PostImage
The postimage represents the value of the record after this operation was performed.
Entity? PostImage { get; }
Property Value
PreImage
The preimage represents the value of the record before the update operation was performed.
Entity? PreImage { get; }
Property Value
Methods
CreateException(string, Exception?)
InvalidPluginExecutionException CreateException(string message, Exception? innerException = null)
Parameters
Returns
GetValue<T>(string)
Get the expected value of the field after the operation checking data in the postimage, target, then preimage (if available).
T? GetValue<T>(string attribute)
Parameters
attribute
stringThe logical name of the attribute to get
Returns
- T
Value of the attribute
Type Parameters
T
Type of the attribute to get
IsFieldChanged(string)
Whether the attribute has a different value between the target input and the preimage. Always returns true for create operations.
bool IsFieldChanged(string attribute)
Parameters
attribute
stringThe logical name of the attribute to check
Returns
- bool
Whether the attribute was changed.