protected override void Execute(CodeActivityContext context) { ITracingService tracingService = (ITracingService)context.GetExtension <ITracingService>(); IWorkflowContext workflowContext = (IWorkflowContext)context.GetExtension <IWorkflowContext>(); IOrganizationServiceFactory serviceFactory = (IOrganizationServiceFactory)context.GetExtension <IOrganizationServiceFactory>(); IOrganizationService service = serviceFactory.CreateOrganizationService(workflowContext.UserId); tracingService.Trace("Patient Details using input and output parameters Workflow Started."); var patientName = PatientName.Get(context); var dateOfBirth = DateOfBirth.Get(context); var hospital = ((EntityReference)(Hospital.Get(context))).Id; var hospitalid = ((EntityReference)(Hospital.Get(context))).Name; var patientStatus = PatientStatus.Get(context); var hospitalizationRequired = HospitalizationRequired.Get(context); var patientAge = PatientAge.Get(context); var consultationFee = ConsultationFee.Get(context); var estimatedAmount = EstimatedAmount.Get(context); var treatmentCost = ((OptionSetValue)(TreatmentCost.Get(context))).Value; var patientId = PatientInOut.Get(context); tracingService.Trace($"Patient Name : {patientName}, Date Of Birth : {dateOfBirth}, Hospital : {hospital}, Patient Status : {patientStatus}, Hospitalization Required: {hospitalizationRequired}, Patient Age: {patientAge}, Consultation Fee : {consultationFee}, Estimated Amount : {estimatedAmount}, Treatment Cost : {treatmentCost}, Patient ID : {patientId}"); var patientDetails = $"Patient Name : {patientName}, Date Of Birth : {dateOfBirth}, Hospital : {hospital}, Patient Status : {patientStatus}, Hospitalization Required: {hospitalizationRequired}, Patient Age: {patientAge}, Consultation Fee : {consultationFee}, Estimated Amount : {estimatedAmount}, Treatment Cost : {treatmentCost}, Patient ID : {patientId}"; PatientInOut.Set(context, PatientInOut.ToString()); ShowPatientDetails.Set(context, patientDetails); tracingService.Trace("Patient Details using input and output parameters Workflow Ended."); }