private void StartCRMWorkflow(ref ServiceObject so)
        {
            SourceCode.SmartObjects.Services.ServiceSDK.Objects.Method meth = so.Methods[0];
            WizardFunctions helper = new WizardFunctions();
            CRMWorkflow     crmWF  = new CRMWorkflow();

            crmWF.Config = crmconfig;

            try
            {
                crmWF.EntityId     = NotNull(so.Properties["EntityId"].Value);
                crmWF.WorkflowName = NotNull(so.Properties["WorkflowName"].Value);

                RestResponse <CRMWorkflow> response = helper.StartWorkflow(crmWF, config);

                so.Properties.InitResultTable();

                for (int c = 0; c < meth.ReturnProperties.Count; c += 1)
                {
                    Property prop = so.Properties[meth.ReturnProperties[c]];
                    prop = SetCRMWorkflowProperties(prop, response);
                }

                so.Properties.BindPropertiesToResultTable();
            }
            catch (Exception ex)
            {
                throw;
            }
        }
        public RestResponse <CRMWorkflow> StartWorkflow(CRMWorkflow crmWF, K2CRMConfig config)
        {
            var client = new RestClient(config.RESTUrl);

            var request = new RestRequest();

            request.Method        = Method.POST;
            request.Credentials   = config.CredentialCache;
            request.RequestFormat = RestSharp.DataFormat.Json;
            request.Resource      = "K2CRM/CRMStartWorkflow";

            request.AddBody(crmWF);

            RestResponse <CRMWorkflow> response = client.Execute <CRMWorkflow>(request);

            return(response);
        }
        public RestResponse<CRMWorkflow> StartWorkflow(CRMWorkflow crmWF, K2CRMConfig config)
        {
            var client = new RestClient(config.RESTUrl);

            var request = new RestRequest();
            request.Method = Method.POST;
            request.Credentials = config.CredentialCache;
            request.RequestFormat = RestSharp.DataFormat.Json;
            request.Resource = "K2CRM/CRMStartWorkflow";

            request.AddBody(crmWF);

            RestResponse<CRMWorkflow> response = client.Execute<CRMWorkflow>(request);

            return response;
        }