Created
October 4, 2019 21:11
-
-
Save AshV/899d306132352e85c2f94132c7505268 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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