예제 #1
0
        public void BulkRunWorkflowTest1()
        {
            CrmConnection         c       = new CrmConnection("CRM");
            OrganizationService   service = new OrganizationService(c);
            CrmBulkServiceManager mgr     = new CrmBulkServiceManager(service);

            List <Entity> entityList = new List <Entity>();

            for (int i = 0; i < 10; i++)
            {
                Entity entity = new Entity("account");
                entity["name"] = "account " + DateTime.Now.ToString();
                entityList.Add(entity);
            }

            var results = mgr.BulkInsert(entityList);

            entityList.Clear();
            foreach (var item in results.ResultItems)
            {
                Entity entity = new Entity("account");
                entity.Id      = item.ItemID;
                entity["name"] = "account " + DateTime.Now.ToString();
                entityList.Add(entity);
            }

            var workflowID = GetWorkflowID(service, "account", "UnitTest Account");

            results = mgr.BulkRunWorkflow(entityList, workflowID);
        }
예제 #2
0
        public void BulkRunWorkflowQueryTest1()
        {
            CrmConnection         c       = new CrmConnection("CRM");
            OrganizationService   service = new OrganizationService(c);
            CrmBulkServiceManager mgr     = new CrmBulkServiceManager(service);

            List <Entity> entityList = new List <Entity>();

            QueryExpression q = new QueryExpression("account");

            q.ColumnSet = new ColumnSet();
            q.ColumnSet.AddColumn("accountid");
            q.Criteria = new FilterExpression();
            q.Criteria.AddCondition("statecode", ConditionOperator.Equal, 0);

            var workflowID = GetWorkflowID(service, "account", "UnitTest Account");

            var results = mgr.BulkRunWorkflow(q, workflowID);
        }