Create Resource Group in Microsoft CRM via SDK


Hi,

if you create a resource in crm, use ConstraintBasedGroup class.
here is a sample code ;



    //get current Resource Group
    List resourcegroupS = context.ConstraintBasedGroupSet.Where(rg => rg.Name == " ").ToList();
    if (resourcegroupS.Count <= 0) //if exists
    {
                        //create resource group:
                        resourcegroupDriver = new ConstraintBasedGroup
                        {
                            BusinessUnitId = new EntityReference(BusinessUnit.EntityLogicalName, businessunit.Id),
                            Name = "Drivers : " + businessunit.Name,
                            Constraints = builder.ToString(),
                            GroupTypeCode = new OptionSetValue(ConstraintBasedGroupTypeCode.Static),
                        };

                        xxx.Id = _serviceProxy.Create(resourcegroupDriver);
                    }
    }

if you need more information about 'context' and '_serviceProxy' objects in the sample code.Please follow :
http://muhammetatalay.blogspot.com/2012/11/retrieve-records-in-microsoft-crm-2011.html


Comments

Popular posts from this blog

Could not load file or assembly 'System.ServiceModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'. The system cannot find the file specified at Configuration class initiation in CrmServiceHelper.cv

Exception caught instantiating TERADATA report server extension SQL Reporting Services

you face "ISV code aborted the operation" when you change status of the any record in Dynamics CRM 2013