protected override void Execute(CodeActivityContext eContext) { var lookup = LookupAttribute.Get(eContext); var orgurl = OrgUrl.Get(eContext); var context = eContext.GetExtension<IWorkflowContext>(); var serviceFactory = eContext.GetExtension<IOrganizationServiceFactory>(); var service = serviceFactory.CreateOrganizationService(context.UserId); var reference = GetReference(service, lookup, new EntityReference(context.PrimaryEntityName, context.PrimaryEntityId)); // Update Reference Information if (reference == null) return; ID.Set(eContext, reference.Id.ToString()); LogicalName.Set(eContext, reference.LogicalName); // Update URL Information if (string.IsNullOrWhiteSpace(orgurl)) return; var url = CreateUrl(orgurl, reference); URL.Set(eContext, url); HtmlLink.Set(eContext, CreateHtmlLink(service, reference, url, LinkText.Get(eContext))); }