public override void ExecuteCRMWorkFlowActivity(CodeActivityContext context, LocalWorkflowContext crmWorkflowContext) { //Read Assignment Id var assignmentId = Assignment.Get <EntityReference>(context).Id; crmWorkflowContext.TracingService.Trace("Assignment Id retrieved"); Utils.Assigment assignmentUtils = new Utils.Assigment(assignmentId, crmWorkflowContext.OrganizationService, crmWorkflowContext.TracingService); Entity assignment = crmWorkflowContext.OrganizationService.Retrieve("educ_assignment", assignmentId, new ColumnSet(new string[] { "educ_contact" })); EntityReference contactReference = (EntityReference)assignment["educ_contact"]; //Fetch the Related Contact Entity fields from Dynamics Entity relatedContact = crmWorkflowContext.OrganizationService.Retrieve("contact", contactReference.Id, new ColumnSet(new string[] { "educ_supplierissue" })); string contactSupplierStatus = relatedContact.FormattedValues["educ_supplierissue"]; //LogSupplierStatusValue(crmWorkflowContext, contactSupplierStatus); if (contactSupplierStatus == "Supplier Verified") { assignmentUtils.GeneratedPaymentRecords(); } else { crmWorkflowContext.Trace(string.Format("\n Custom Message from GenerateAssignmentPayment Workflow: \n \"The Contact Supplier Status = {0}\" \n End of Message: \n\n", contactSupplierStatus)); throw new InvalidPluginExecutionException(OperationStatus.Canceled); } }
public override void ExecuteCRMWorkFlowActivity(CodeActivityContext context, LocalWorkflowContext crmWorkflowContext) { //Read Assignment Id var assignmentId = Assignment.Get <EntityReference>(context).Id; crmWorkflowContext.TracingService.Trace("Assignment Id retrieved"); Utils.Assigment assignmentUtils = new Utils.Assigment(assignmentId, crmWorkflowContext.OrganizationService, crmWorkflowContext.TracingService); assignmentUtils.GeneratedPaymentRecords(); }