CRM operation product entity

Source: Internet
Author: User

Using system;
Using Microsoft. xrm. SDK;
Using Microsoft. CRM. SDK. messages;

/// <Summary>
/// Product
/// </Summary>
Public class producthelper
{
Public static readonly string entityname = "product ";
Public guid productid = guid. empty;
Public iorganizationservice service;

/// <Summary>
/// Create a product
/// </Summary>
Public void create ()
{
Entity en = new entity () {logicalname = entityname };
En ["name"] = "product test ";
Productid = service. Create (en );
}

/// <Summary>
/// Add a product to the accessory kit. A combination kit is a product catalog item that contains one or more products.
/// </Summary>
/// <Param name = "kitid"> accessory id </param>
Public void addproducttokit (guid kitid)
{
Addproducttokitrequest request = new addproducttokitrequest ();
Request. kitid = kitid;
Request. productid = productid;
Addproducttokitresponse response = (addproducttokitresponse) service. Execute (request );
}

/// <Summary>
/// Convert the accessory kit into a product
/// </Summary>
/// <Param name = "kitid"> accessory id </param>
Public void convertkittoproduct (guid kitid)
{
Convertkittoproductrequest request = new convertkittoproductrequest ();
Request. kitid = kitid;
Convertkittoproductresponse response = (convertkittoproductresponse) service. Execute (request );
}

/// <Summary>
/// Convert the product to the accessory
/// </Summary>
Public void convertproducttokit ()
{
Convertproducttokitrequest request = new convertproducttokitrequest ();
Request. productid = productid;
Convertproducttokitresponse response = (convertproducttokitresponse) service. Execute (request );
}

/// <Summary>
/// Delete the product from the accessory Kit
/// </Summary>
/// <Param name = "kitid"> accessory id </param>
Public void removeproductfromkit (guid kitid)
{
Removeproductfromkitrequest request = new removeproductfromkitrequest ();
Request. kitid = kitid;
Request. productid = productid;
Removeproductfromkitresponse response = (removeproductfromkitresponse) service. Execute (request );
}

/// <Summary>
/// Delete the product
/// </Summary>
Public void Delete ()
{
Service. Delete (entityname, productid );
}
}

CRM operation product entity

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.