private Property SetCRMWorkflowProperties(Property prop, CRMWorkflow task)
        {
            if (task != null)
            {
                switch (prop.Name.ToLower())
                {
                    case "entityid":
                        prop.Value = task.EntityId;
                        break;
                    case "workflowid":
                        prop.Value = task.WorkflowId;
                        break;
                }
            }

            return prop;
        }
    public CRMWorkflow CRMStartWorkflowByID(CRMWorkflow crmWF)
    {
        CRMFunctions function = new CRMFunctions(crmWF.Config);

        return(function.CRMStartWorkflowByID(crmWF));
    }
        private void StartCRMWorkflow(ref ServiceObject so)
        {
            SourceCode.SmartObjects.Services.ServiceSDK.Objects.Method meth = so.Methods[0];
            
            CRMWorkflow crmWF = new CRMWorkflow();
            crmWF.Config = crmconfig;

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

                CRMWorkflow response = CRMFunctions.CRMStartWorkflow(crmWF);

                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;
            }
        }