public override void Executed(WorkflowData data) { try { EntityReference agreementRef = AgreementReference.Get(data.Context); AgreementService service = new AgreementService(data.OrganizationService); IsHasRelatedInvoices.Set(data.Context, service.IsHasRelatedInvoices(agreementRef)); IsHasRelatedInvoicesWithPaidState.Set(data.Context, service.IsHasRelatedInvoicesWithPaidState(agreementRef)); IsHasRelatedInvoicesWithCommonType.Set(data.Context, service.IsHasRelatedInvoicesWithCommonType(agreementRef)); } catch (Exception ex) { data.TracingService.Trace(ex.ToString()); throw new InvalidWorkflowException(ex.Message); } }