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 →

Advertisements

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

Nishant Rana's Weblog

Hi,

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 →

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 →

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 →

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 →

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 →

Working with Goals – Rollup Query

We can create Rollup Queries using CRM SDK (plugin or workflow or some external tool). In this entity, MS CRM provided similar to advance find capability for Query attribute, CRM stores it in database as 'fetchxml' attribute in fetch-XML (XML) format. Thus, we can create edit that attribute with code behind.  Here is the sample... Continue Reading →

Common plugin for Deactivate / Delete all associated entity

Its walk-through for deactivating all associated (1:N) records. Steps for that are Create plugin Register and create steps Create plugin public class DeactivateAssociates : BaseClass { IOrganizationService service; public override void OnExecute(PluginExecution exeObject) { //'Get service reference service = exeObject.orgService; exeObject.tracingService.Trace("deactivation entity is started.."); //check on create if ((exeObject.pluginContext.InputParameters.Contains("EntityMoniker")) && (exeObject.pluginContext.InputParameters["EntityMoniker"] is EntityReference)) { exeObject.tracingService.Trace("geting entity... Continue Reading →

Create a free website or blog at WordPress.com.

Up ↑

%d bloggers like this: