workflow execution from Plugin

Here is quick sample code for workflow execution from Plugin ... Execute workflow ... /// <summary> /// Execute porcess /// </summary> /// <param name="entityId"></param> /// <param name="service"></param> /// <param name="workflowId"></param> private static void ExecuteProcess(IOrganizationService service, Guid entityId, Guid workflowId) { ExecuteWorkflowRequest request = new ExecuteWorkflowRequest() { WorkflowId = workflowId, EntityId = entityId }; // Execute … Continue reading workflow execution from Plugin


Sample code to retrieve more than 5000 records using FetchXML in CRM

Nishant Rana's Weblog


Sharing a sample code to retrieve more than 5000 records using the Fetch XML.

Version 1 :

Version 2 :

Hope it helps..

View original post

Query hierarchical data

Retiring hierarchical data is easy, we don't need to iterate by for/while loop. just use 'Above' or 'Under' keywords, then it will serve you all parents or all child available. in regular query, just 'ConditionOperator.Above' to get all parents. in regular query, just 'ConditionOperator.Under' to get all child. How to create this type of structure … Continue reading Query hierarchical data

LinkEntity issue with ‘Partyid’

Today, I was working with LinkEntity for 'PartyId', So I want all appointment where specific account or contact is in the required field and is connected to a specific entity. Thus, I created 3 appointments on the entity and wrote following query... QueryExpression appointmentQuery = new QueryExpression("appointment"); appointmentQuery.ColumnSet = new ColumnSet("activityid", "requiredattendees", "optionalattendees", "regardingobjectid", "createdon", "scheduledstart", "soft_consulationsubtypeid", … Continue reading LinkEntity issue with ‘Partyid’

Linq Entity with filter

Many times we need to joins with filters in one entity or both of them. Here is the simple sample ... var tcIncentiveId = new Guid("31EE1300-AA49-E711-8100-000D3AD073D7"); //context.Trace("trace " + tcIncentiveId); Entity tcincentive = service.Retrieve("aams_tcincentive", tcIncentiveId, new ColumnSet(true)); //first entity - QueryExpression queryFirstEntity = new QueryExpression("soft_tcincentive"); //first entity columns to fetch queryFirstEntity.ColumnSet = new ColumnSet("soft_tcincentiveid"); //first … Continue reading Linq Entity with filter

Error: AliasedValue – Key not found

Error: Key not found in Link Entity QueryExpression (Ref above image). Solution Sample Code  QueryExpression queryTcMilestone = new QueryExpression("soft_tcmilestone"); queryTcMilestone.ColumnSet = new ColumnSet("soft_tcmilestoneid", "soft_amount", "soft_milestonedate"); queryTcMilestone.Criteria.AddCondition("statecode", ConditionOperator.Equal, 0); queryTcMilestone.Criteria.AddCondition("soft_incentiveid", ConditionOperator.Equal, tcIncentiveId); queryTcMilestone.AddOrder("soft_milestonedate", OrderType.Descending); LinkEntity linkClaim = new LinkEntity() { LinkFromEntityName = "soft_tcmilestone", LinkFromAttributeName = "soft_claimid", LinkToEntityName = "soft_claim", LinkToAttributeName = "soft_claimid", JoinOperator = JoinOperator.Inner, Columns … Continue reading Error: AliasedValue – Key not found

Consume Web-request from Plugin

Generally, CRM not works alone, it includes many other application, such time we needs to move data from one application to another. In this situation we needs integration; We do integration with either “HttpWebRequest” or “BasicHttpBinding”.  Explore “HttpWebRequest” implementation here . To consume web-service using “BasicHttpBinding”, I used following way. Created a proxy class for web … Continue reading Consume Web-request from Plugin