Skip to content
This repository has been archived by the owner on Aug 15, 2024. It is now read-only.

Innofactor.Xrm.Utils.Workflow

Alexey Shytikov edited this page Feb 12, 2019 · 1 revision

Contents

ActivityBase type

Namespace

Innofactor.Xrm.Utils.Workflow

#ctor() constructor

Summary

Initializes a new instance of the ActivityBase class. Will use refrected name of the calling plugin.

Parameters

This constructor has no parameters.

ActivityContainer type

Namespace

Innofactor.Xrm.Utils.Workflow

Service property

Summary

Gets instance of assosiated with current container

ContainerExtensions type

Namespace

Innofactor.Xrm.Utils.Common.Extensions

Summary

Extension methods for IContainable classes

Associate(container,entity,relatedentity,intersect) method

Summary

Associates current record with relatedentity, using specified intersect relationship

Parameters
Name Type Description
container Innofactor.Xrm.Utils.Common.Interfaces.IExecutionContainer
entity Microsoft.Xrm.Sdk.Entity Current entity
relatedentity Microsoft.Xrm.Sdk.Entity Related entity
intersect System.String Name of the intersect relationship/entity
Exceptions
Name Description
System.ServiceModel.FaultException`1 may be typed as:

OrganizationServiceFault: Thrown when association already exists. |

Remarks

To be used with N:N-relationships.

Associate(container,entity,relatedEntities,intersect) method

Summary

Associates current record with relatedentities, using specified intersect relationship

Parameters
Name Type Description
container Innofactor.Xrm.Utils.Common.Interfaces.IExecutionContainer
entity Microsoft.Xrm.Sdk.Entity
relatedEntities Microsoft.Xrm.Sdk.EntityCollection Collection of the entities to be related to current entity
intersect System.String Name of the intersect relationship/entity
Exceptions
Name Description
System.ServiceModel.FaultException`1 may be typed as:

OrganizationServiceFault: Thrown when any of the associations already exists. |

Remarks

To be used with N:N-relationships.

Associate(entity,container,relatedEntities,intersect,batchSize) method

Summary

Associates current record with relatedentities, using specified intersect relationship

Parameters
Name Type Description
entity Innofactor.Xrm.Utils.Common.Interfaces.IExecutionContainer
container Microsoft.Xrm.Sdk.Entity
relatedEntities Microsoft.Xrm.Sdk.EntityCollection Collection of the entities to be related to current entity
intersect System.String Name of the intersect relationship/entity
batchSize System.Int32 Optional. Determines the max number of entities to associate per request
Exceptions
Name Description
System.ServiceModel.FaultException`1 may be typed as:

OrganizationServiceFault: Thrown when any of the associations already exists. |

Remarks

To be used with N:N-relationships.

Attribute(container,name) method

Summary

Initiates work with attributes

Returns
Parameters
Name Type Description
container Innofactor.Xrm.Utils.Common.Interfaces.IExecutionContainer
name System.String

Convert(container,query) method

Summary

Converts QueryExpression to FetchXml

Returns
Parameters
Name Type Description
container Innofactor.Xrm.Utils.Common.Interfaces.IExecutionContainer
query Microsoft.Xrm.Sdk.Query.QueryExpression

Create(container,entity) method

Summary
Returns

The Guid of the created entity.

Parameters
Name Type Description
container Innofactor.Xrm.Utils.Common.Interfaces.IExecutionContainer
entity Microsoft.Xrm.Sdk.Entity

Delete(container,entity) method

Summary
Parameters
Name Type Description
container Innofactor.Xrm.Utils.Common.Interfaces.IExecutionContainer
entity Microsoft.Xrm.Sdk.Entity

EndSection() method

Summary

End section in the log file.

Parameters

This method has no parameters.

Ensure(container,entity,attribute) method

Summary

Checks if a property exists in the encapsulated Entity

Returns
Parameters
Name Type Description
container Innofactor.Xrm.Utils.Common.Interfaces.IExecutionContainer
entity Microsoft.Xrm.Sdk.Entity
attribute System.String Name of property to check

Entity(container,target) method

Summary

Initiates work with entitites

Returns
Parameters
Name Type Description
container Innofactor.Xrm.Utils.Common.Interfaces.IExecutionContainer
target Microsoft.Xrm.Sdk.Entity

Entity(container,target) method

Summary

Initiates work with entitites

Returns
Parameters
Name Type Description
container Innofactor.Xrm.Utils.Common.Interfaces.IExecutionContainer
target Microsoft.Xrm.Sdk.EntityReference

Entity(container,logicalName) method

Summary

Initiates work with entitites

Returns
Parameters
Name Type Description
container Innofactor.Xrm.Utils.Common.Interfaces.IExecutionContainer
logicalName System.String

Execute(container,request) method

Summary

Method to be used when retrieving metadata, to be able to benefit from metadata caching abilities

Returns
Parameters
Name Type Description
container Innofactor.Xrm.Utils.Common.Interfaces.IExecutionContainer
request Microsoft.Xrm.Sdk.Messages.RetrieveEntityRequest Metadata request

Execute(container,request) method

Summary

Method to be used when retrieving metadata, to be able to benefit from metadata caching abilities

Returns
Parameters
Name Type Description
container Innofactor.Xrm.Utils.Common.Interfaces.IExecutionContainer
request Microsoft.Xrm.Sdk.Messages.RetrieveAttributeRequest Metadata request

Log(message,args) method

Summary

Write message and parameter values to the log file.

Parameters
Name Type Description
message Innofactor.Xrm.Utils.Common.Interfaces.IExecutionContainer
args System.String

Merge(container,entity1,entity2) method

Summary
Returns
Parameters
Name Type Description
container Innofactor.Xrm.Utils.Common.Interfaces.IExecutionContainer
entity1 Microsoft.Xrm.Sdk.Entity
entity2 Microsoft.Xrm.Sdk.Entity

Principal(container,principal) method

Summary

Initiates work with principals which is followed with access related opetations: Grant / Revoke / Assign

Returns
Parameters
Name Type Description
container Innofactor.Xrm.Utils.Common.Interfaces.IExecutionContainer
principal Microsoft.Xrm.Sdk.Entity

Principal(container,principal) method

Summary

Initiates work with principals which is followed with access related opetations: Grant / Revoke / Assign

Returns
Parameters
Name Type Description
container Innofactor.Xrm.Utils.Common.Interfaces.IExecutionContainer
principal Microsoft.Xrm.Sdk.EntityReference

Reload(container,entity) method

Summary

Reloads encapsulated Entity from database

Parameters
Name Type Description
container Innofactor.Xrm.Utils.Common.Interfaces.IExecutionContainer
entity Microsoft.Xrm.Sdk.Entity
Remarks

ToStringWithEntityName() is replaced with entity.LogicalName

Reload(container,entity,columns) method

Summary

Reloads encapsulated Entity from database

Parameters
Name Type Description
container Innofactor.Xrm.Utils.Common.Interfaces.IExecutionContainer
entity Microsoft.Xrm.Sdk.Entity
columns System.String[] Set of colums with which entity should be reloaded
Remarks

ToStringWithEntityName() is replaced with entity.LogicalName

Reload(container,entity,columns) method

Summary

Reloads encapsulated Entity from database

Parameters
Name Type Description
container Innofactor.Xrm.Utils.Common.Interfaces.IExecutionContainer
entity Microsoft.Xrm.Sdk.Entity
columns Microsoft.Xrm.Sdk.Query.ColumnSet Set of colums with which entity should be reloaded
Remarks

ToStringWithEntityName() is replaced with entity.LogicalName

Retrieve(container,reference,columns) method

Summary

Encapsulated Retrieve method to be invoked on the service

Returns
Parameters
Name Type Description
container Innofactor.Xrm.Utils.Common.Interfaces.IExecutionContainer
reference Microsoft.Xrm.Sdk.EntityReference
columns System.String[] Set of colums with which entity should be reloaded

Retrieve(container,reference,columnSet) method

Summary

Encapsulated Retrieve method to be invoked on the service

Returns
Parameters
Name Type Description
container Innofactor.Xrm.Utils.Common.Interfaces.IExecutionContainer
reference Microsoft.Xrm.Sdk.EntityReference
columnSet Microsoft.Xrm.Sdk.Query.ColumnSet

Retrieve(container,entityName,id,columns) method

Summary

Encapsulated Retrieve method to be invoked on the service

Returns
Parameters
Name Type Description
container Innofactor.Xrm.Utils.Common.Interfaces.IExecutionContainer
entityName System.String
id System.Guid
columns System.String[] Set of colums with which entity should be reloaded

Retrieve(container,entityName,id,columnSet) method

Summary

Encapsulated Retrieve method to be invoked on the service

Returns
Parameters
Name Type Description
container Innofactor.Xrm.Utils.Common.Interfaces.IExecutionContainer
entityName System.String
id System.Guid
columnSet Microsoft.Xrm.Sdk.Query.ColumnSet

RetrieveMultiple(container,query) method

Summary
Returns
Parameters
Name Type Description
container Innofactor.Xrm.Utils.Common.Interfaces.IExecutionContainer
query Microsoft.Xrm.Sdk.Query.QueryBase

RetrieveMultiple(container,entity,attribute,value,columns) method

Summary

Retrieve objects matching given criteria

Returns

EntityCollection that encapsulate the resulting Entity records

Parameters
Name Type Description
container Innofactor.Xrm.Utils.Common.Interfaces.IExecutionContainer
entity System.String Entity's logical name
attribute System.String[]
value System.Object[]
columns Microsoft.Xrm.Sdk.Query.ColumnSet

Save(container,entity) method

Summary

Save the entity record. If it has a valid Id it will be updated, otherwise new record created.

Parameters
Name Type Description
container Innofactor.Xrm.Utils.Common.Interfaces.IExecutionContainer
entity Microsoft.Xrm.Sdk.Entity

SetState(container,entity,state,status) method

Summary

Update state and status of current record

Parameters
Name Type Description
container Innofactor.Xrm.Utils.Common.Interfaces.IExecutionContainer
entity Microsoft.Xrm.Sdk.Entity
state System.Int32 Active=0 and Inactive=1
status System.Int32 Active=1 and Inactive=2
Remarks

http://msdynamicscrmblog.wordpress.com/2013/10/26/status-and-status-reason-values-in-dynamics-crm-2013/comment-page-1/ ToStringWithEntityName() is replaced with entity.LogicalName

StartSection(name) method

Summary

Starts a section in the log file

Parameters
Name Type Description
name Innofactor.Xrm.Utils.Common.Interfaces.IExecutionContainer

Update(container,entity) method

Summary
Parameters
Name Type Description
container Innofactor.Xrm.Utils.Common.Interfaces.IExecutionContainer
entity Microsoft.Xrm.Sdk.Entity

EntityCollectionExtensions type

Namespace

Innofactor.Xrm.Utils.Common.Extensions

Summary

Extension methods for EntityCollection class

Add(collection,entity) method

Summary

Adds entity to current collection

Parameters
Name Type Description
collection Microsoft.Xrm.Sdk.EntityCollection
entity Microsoft.Xrm.Sdk.Entity

AddRange(collection,entities) method

Summary

Adds range of entities to current collection

Parameters
Name Type Description
collection Microsoft.Xrm.Sdk.EntityCollection
entities Microsoft.Xrm.Sdk.EntityCollection

Contains(collection,item) method

Summary

Checks if specified item is available in the collection. Comparison is strictly by Id.

Returns
Parameters
Name Type Description
collection Microsoft.Xrm.Sdk.EntityCollection
item Microsoft.Xrm.Sdk.Entity

Contains(collection,id) method

Summary

Checks if a record with specified id is available in the collection.

Returns
Parameters
Name Type Description
collection Microsoft.Xrm.Sdk.EntityCollection
id System.Guid

Count(collection) method

Summary

Counts number of record in current collection

Returns
Parameters
Name Type Description
collection Microsoft.Xrm.Sdk.EntityCollection

Get(collection,id) method

Summary

Returns record with specified id if it's available in the collection.

Returns
Parameters
Name Type Description
collection Microsoft.Xrm.Sdk.EntityCollection
id System.Guid

Sort(collection,attributes) method

Summary

Sort the collection based on given attribute names

Parameters
Name Type Description
collection Microsoft.Xrm.Sdk.EntityCollection
attributes System.String[] Array of attribute names to sort by. Prepend attribute name with ! to sort DESC.

ToEntityReferenceCollection(collection) method

Summary

Turns collection of Entity into collection of EntityReference

Returns
Parameters
Name Type Description
collection Microsoft.Xrm.Sdk.EntityCollection

EntityComparer type

Namespace

Innofactor.Xrm.Utils.Common.Misc

Summary

A class used to compare cintdynentity instances

#ctor(attributes) constructor

Summary

Constructor of CintDynEntity class. Takes a list of attribute names as an argument.

Parameters
Name Type Description
attributes System.String[] The attributes to sort the comparison by......

SortAttributes property

Summary

Property returning the configured sort attributes.

Returns

The list of sort attributes

Compare(x,y) method

Summary

The method that performs the actual comparison in the CintDynEntityComparer class.

Returns

An integer which is greater than 0 if the x parameter is greater than the y parameter, 0 if they are equal, and negative if x is less than y.

Parameters
Name Type Description
x Microsoft.Xrm.Sdk.Entity The Entity to compare.
y Microsoft.Xrm.Sdk.Entity The Entity to compare with.

EntityExtensions type

Namespace

Innofactor.Xrm.Utils.Common.Extensions

Summary

Light-weight features inspired by CintDynEntity

CloneAttributes(entity) method

Summary

Clones entity instance to a new C# instance

Returns

Cloned entity

Parameters
Name Type Description
entity Microsoft.Xrm.Sdk.Entity
Remarks

Does NOT create a copy in database, just a new copy to work with in code.

CloneId(entity) method

Summary

Clones entity instance to a new C# instance

Returns

Cloned entity

Parameters
Name Type Description
entity Microsoft.Xrm.Sdk.Entity
Remarks

Does NOT create a copy in database, just a new copy to work with in code.

Contains(entity,name,notnull) method

Summary
Returns
Parameters
Name Type Description
entity Microsoft.Xrm.Sdk.Entity
name System.String
notnull System.Boolean

GetAttribute``1(entity,attribute,default) method

Summary

Generic method to retrieve property with name "name" of type "T"

Returns
Parameters
Name Type Description
entity Microsoft.Xrm.Sdk.Entity
attribute System.String
default ``0
Generic Types
Name Description
T

IsActive(entity,default) method

Summary

Gets bool indicating if record is active (writable) or inactive.

Returns
Parameters
Name Type Description
entity Microsoft.Xrm.Sdk.Entity
default System.Boolean Default value if statecode is missing in entity.

IsActive(entity) method

Summary

Returns true if entity has an active state. If statecode is not available in the attribute collection an exception is thrown.

Returns
Parameters
Name Type Description
entity Microsoft.Xrm.Sdk.Entity

Merge(container,entity1,entity2) method

Summary
Returns
Parameters
Name Type Description
container Microsoft.Xrm.Sdk.Entity
entity1 Microsoft.Xrm.Sdk.Entity

PropertyLinkedEntity``1(entity,linkedEntityAlias,name,default) method

Summary

Om entiteten innehåller attribut från länkade entiteter efter läsning så måste aliaset för den länkade entiteten anges.

Returns
Parameters
Name Type Description
entity Microsoft.Xrm.Sdk.Entity
linkedEntityAlias System.String
name System.String
default ``0
Generic Types
Name Description
T

RemoveProperty(entity,name) method

Summary
Parameters
Name Type Description
entity Microsoft.Xrm.Sdk.Entity
name System.String

SetAttribute``1(entity,name,value) method

Summary

Generic method to add property with "name" and set its value of type "T" to "value"

Parameters
Name Type Description
entity Microsoft.Xrm.Sdk.Entity
name System.String
value ``0
Generic Types
Name Description
T

SetOwner(entity,user) method

Summary

Sätter current user (from context) som owner på entity

Parameters
Name Type Description
entity Microsoft.Xrm.Sdk.Entity
user System.Guid

IActivityExecutionContainer type

Namespace

Innofactor.Xrm.Utils.Workflow.Interfaces

Summary

Plugin specific extensions to IContainable

ActivityContext property

Summary

Gets instance of the CodeActivityContext assosiated with current container

WorkflowContext property

Summary

Gets instance of the IWorkflowContext assosiated with current container

IExecutionContainer type

Namespace

Innofactor.Xrm.Utils.Common.Interfaces

Summary

Core object that helps to keep all objects and methods needed for CRM development in package easy to access and operate

Logger property

Summary

Get instance of the ITracingService assosiated with current container

Service property

Summary

Gets instance of IOrganizationService assosiated with current container

OperationsSet1 type

Namespace

Innofactor.Xrm.Utils.Common.Fluent.Access

OperationsSet1 type

Namespace

Innofactor.Xrm.Utils.Common.Fluent.Attribute

On(target) method

Summary

Adds information about entity to work with

Returns
Parameters
Name Type Description
target Microsoft.Xrm.Sdk.Entity

On(target) method

Summary

Adds information about entity to work with

Returns
Parameters
Name Type Description
target Microsoft.Xrm.Sdk.EntityReference

On(target) method

Summary

Adds information about entity to work with

Returns
Parameters
Name Type Description
target Microsoft.Xrm.Sdk.Entity

OperationsSet2 type

Namespace

Innofactor.Xrm.Utils.Common.Fluent.Access

OperationsSet2 type

Namespace

Innofactor.Xrm.Utils.Common.Fluent.Attribute

OperationsSet2 type

Namespace

Innofactor.Xrm.Utils.Common.Fluent.Entity

PrimaryIdAttribute property

Summary

Primary Id attribute of the entity

PrimaryNameAttribute property

Summary

Primary Name attribute of the entity

Assign() method

Summary

Assigns current record to given principal

Returns
Parameters

This method has no parameters.

Grant(accessMask) method

Summary

Grants access to current record to given principal

Returns
Parameters
Name Type Description
accessMask Microsoft.Crm.Sdk.Messages.AccessRights

Revoke() method

Summary

Revokes access from current record from given principal

Returns
Parameters

This method has no parameters.

Expand(columns) method

Summary

Will add given columns to the operation

Returns
Parameters
Name Type Description
columns Microsoft.Xrm.Sdk.Query.ColumnSet

Expand(columns) method

Summary

Will add given columns to the operation

Returns
Parameters
Name Type Description
columns System.String[]

ToString() method

Summary

Gets a readable string representation of given attribute

Returns

Formatted value of the attribute

Parameters

This method has no parameters.

GetPrimaryIdAttribute() method

Summary

Get the primary id attribute of the target entity

Returns
Parameters

This method has no parameters.

Remarks

Metadata request that is time consuming, but results are cached.

GetPrimaryNameAttribute() method

Summary

Gets primary name attribute of the entity

Returns
Parameters

This method has no parameters.

OperationsSet3 type

Namespace

Innofactor.Xrm.Utils.Common.Fluent.Entity

Via(name) method

Summary

Sets name of the attribute or relation via which association was perfomed

Returns
Parameters
Name Type Description
name System.String Name of the attribute or relation

OperationsSet4 type

Namespace

Innofactor.Xrm.Utils.Common.Fluent.Entity

Active(value) method

Summary

Add locking flag explicitly

Returns
Parameters
Name Type Description
value System.Boolean

Expand(columns) method

Summary

Retrieves records (children) relating to current record (parent)

Returns
Parameters
Name Type Description
columns Microsoft.Xrm.Sdk.Query.ColumnSet ColumnSet to expand

Expand(columns) method

Summary

Will add given columns to the operation

Returns
Parameters
Name Type Description
columns System.String[]

FilteredBy(condition) method

Summary

Add fintering condition to composed query

Returns
Parameters
Name Type Description
condition Microsoft.Xrm.Sdk.Query.FilterExpression FilterExpression to apply

Lock(value) method

Summary

Add locking flag explicitly

Returns
Parameters
Name Type Description
value System.Boolean

SortedBy(order) method

Summary

Add sorting order to composed query

Returns
Parameters
Name Type Description
order Microsoft.Xrm.Sdk.Query.OrderExpression OrderExpression to apply

SortedBy(attributeName,orderType) method

Summary

Add sorting order to composed query

Returns
Parameters
Name Type Description
attributeName System.String
orderType Microsoft.Xrm.Sdk.Query.OrderType

SortedBy(order) method

Summary

Add sorting order to composed query

Returns
Parameters
Name Type Description
order System.Collections.Generic.IEnumerable{Microsoft.Xrm.Sdk.Query.OrderExpression} Collection of OrderExpression to apply

Query type

Namespace

Innofactor.Xrm.Utils.Common.Misc

Summary

Various utils for retrieving and updating entities and attributes

AppendCondition(filt,type,attr,oper,val) method

Summary

Appends QueryExpression Condition to the FilterExpression

Returns
Parameters
Name Type Description
filt Microsoft.Xrm.Sdk.Query.FilterExpression FilterExpression to add condition to
type Microsoft.Xrm.Sdk.Query.LogicalOperator Operator for FilterExpression
attr System.String Attribut to apply condition to
oper Microsoft.Xrm.Sdk.Query.ConditionOperator Operator for condition
val System.Object Value to apply operation on

AppendConditionActive(filt) method

Summary

Appends QueryExpression Condition to verify StateCode=Active

Returns
Parameters
Name Type Description
filt Microsoft.Xrm.Sdk.Query.FilterExpression FilterExpression to add condition to

AppendLink(linkentities,from,to,from_attr,to_attr) method

Summary

Appends QueryExpression linked entity to the LinkEntities list

Returns
Parameters
Name Type Description
linkentities Microsoft.Xrm.Sdk.DataCollection{Microsoft.Xrm.Sdk.Query.LinkEntity} LinkEntities collection to add linked entity to
from System.String Link From entity
to System.String Link To entity
from_attr System.String Attribute name on From entity
to_attr System.String Attribute name on To entity

AppendLink1M(linkentities,from,to) method

Summary

Use to generate link between 1:M entities (for standard identifying field names)

Returns
Parameters
Name Type Description
linkentities Microsoft.Xrm.Sdk.DataCollection{Microsoft.Xrm.Sdk.Query.LinkEntity}
from System.String
to System.String

AppendLinkM1(linkentities,from,to) method

Summary

Use to generate link between M:1 entities (for standard identifying field names)

Returns
Parameters
Name Type Description
linkentities Microsoft.Xrm.Sdk.DataCollection{Microsoft.Xrm.Sdk.Query.LinkEntity}
from System.String
to System.String

AppendLinkMM(linkentities,from,to) method

Summary

Use to generate link between N:N entities (for standard identifying field names and intersect table name)

Returns

LinkEntity for the To entity

Parameters
Name Type Description
linkentities Microsoft.Xrm.Sdk.DataCollection{Microsoft.Xrm.Sdk.Query.LinkEntity}
from System.String
to System.String

AppendLinkMM(linkentities,intersect,from,to) method

Summary

Use to generate link between N:N entities (for standard identifying field names but non-standard intersect table name)

Returns
Parameters
Name Type Description
linkentities Microsoft.Xrm.Sdk.DataCollection{Microsoft.Xrm.Sdk.Query.LinkEntity}
intersect System.String
from System.String
to System.String

AppendLinkMM(linkentities,intersect,from,from_attr,to,to_attr) method

Summary

Use to generate link between N:N entities (for non-standard identifying field names and intersect table name)

Returns

LinkEntity for the To entity

Parameters
Name Type Description
linkentities Microsoft.Xrm.Sdk.DataCollection{Microsoft.Xrm.Sdk.Query.LinkEntity}
intersect System.String
from System.String
from_attr System.String
to System.String
to_attr System.String

GetFilterConditionByAttribute(filter,attribute) method

Summary

Gets first found condition for attribute with given name

Returns

First found ConditionExpression, or null if no condition is found

Parameters
Name Type Description
filter Microsoft.Xrm.Sdk.Query.FilterExpression FilterExpression in which to look for condition, typically myQuery.Criteria
attribute System.String Name of attribute on condition to return
Remarks

Iterated conditions on the filter itself, and any sub filter collections.

SortAttribute type

Namespace

Innofactor.Xrm.Utils.Common.Misc

Summary

A class used to contain the sorting attributes for the comparer class.

#ctor(attribute,type) constructor

Summary

Constructor of SortAttribute class. Takes an attribute name and an OrderType as arguments.

Parameters
Name Type Description
attribute System.String The sort attribute
type Microsoft.Xrm.Sdk.Query.OrderType The sort attribute sorting type (OrderType)

Attribute constants

Summary

Property returning the sort attribute.

Returns

The string that is the sort attribute.

Type constants

Summary

Property returning the sorting type.

Returns

The OrderType value.

Clone this wiki locally