Skip to content

Instantly share code, notes, and snippets.

@AshV
Created October 4, 2019 21:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save AshV/899d306132352e85c2f94132c7505268 to your computer and use it in GitHub Desktop.
Save AshV/899d306132352e85c2f94132c7505268 to your computer and use it in GitHub Desktop.
using Microsoft.Xrm.Sdk;
using Microsoft.Xrm.Sdk.Workflow;
using System;
using System.Activities;
namespace WordCountWorkflow
{
public class WordCount : CodeActivity
{
[Output("phone")]
public OutArgument<string> Phone { get; set; }
protected override void Execute(CodeActivityContext context)
{
var workflowContext = context.GetExtension<IWorkflowContext>();
var serviceFactory = context.GetExtension<IOrganizationServiceFactory>();
var orgService = serviceFactory.CreateOrganizationService(Guid.Parse("22235597-EEA7-4355-9C95-A5FF5777B053"));
var tracingService = context.GetExtension<ITracingService>();
var mobilephone = "_";
var record = orgService.Retrieve(workflowContext.PrimaryEntityName, workflowContext.PrimaryEntityId, new Microsoft.Xrm.Sdk.Query.ColumnSet(nameof(mobilephone)));
mobilephone = record.GetAttributeValue<string>(nameof(mobilephone));
Phone.Set(context, mobilephone);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment