protected override void ExecuteCrmWorkFlowActivity(CodeActivityContext context, LocalWorkflowContext localContext) { if (context == null) { throw new ArgumentNullException(nameof(context)); } if (localContext == null) { throw new ArgumentNullException(nameof(localContext)); } EntityReference noteToCheck = NoteToCheck.Get(context); HasAttachment.Set(context, CheckForAttachment(localContext.OrganizationService, noteToCheck.Id)); }
protected override void Execute(CodeActivityContext executionContext) { ITracingService tracer = executionContext.GetExtension <ITracingService>(); IWorkflowContext context = executionContext.GetExtension <IWorkflowContext>(); IOrganizationServiceFactory serviceFactory = executionContext.GetExtension <IOrganizationServiceFactory>(); IOrganizationService service = serviceFactory.CreateOrganizationService(context.UserId); try { EntityReference noteToCheck = NoteToCheck.Get(executionContext); HasAttachment.Set(executionContext, CheckForAttachment(service, noteToCheck.Id)); } catch (Exception ex) { tracer.Trace("Exception: {0}", ex.ToString()); } }