locked
Generate the FullFill of salesorder programmaticly when closing an incident RRS feed

  • Question

  • I have a pluguin that creates an incident following the creation of a salesorder ,
    I want to generate the Fullfill  of the salesorder following the closing of incident

    can anybody tell me how do that ?

    Thanks al lot

    Friday, May 28, 2010 11:24 AM

Answers

  • i find the solution

    thanks for you all .

    orderclose

     

    ord = new orderclose();

    ord.salesorderid =

    new Lookup();

    ord.salesorderid.type =

    EntityName.salesorder.ToString();

    ord.salesorderid.Value = the Guid of salesorder

    ;

     

    FulfillSalesOrderRequest salesreq = new FulfillSalesOrderRequest();

    salesreq.OrderClose = ord;

    salesreq.Status = 100001;

     

    FulfillSalesOrderResponse salesresp = (FulfillSalesOrderResponse)crmservice.Execute(salesreq);

    Sunday, May 30, 2010 5:20 PM

All replies

  • you  have to generate  salesorderdetail class. see below  for the  code  (from sdk)

    Example

    This sample shows how to create a sales order object and its associated sales order details object.

    CrmAuthenticationToken token = new CrmAuthenticationToken();
    // You can use enums.cs from the SDK\Helpers folder to get the enumeration for Active Directory authentication.
    token.AuthenticationType = 0;
    token.OrganizationName = "AdventureWorksCycle";

    CrmService service = new CrmService();
    service.Url = "http://<servername>:<port>/mscrmservices/2007/crmservice.asmx";
    service.CrmAuthenticationTokenValue = token;
    service.Credentials = System.Net.CredentialCache.DefaultCredentials;

    // Create the sales order object.
    salesorder salesorder = new salesorder();

    // Set the properties of the sales order object.
    salesorder.name = "Test Order";
    salesorder.customerid = new Customer();
    salesorder.customerid.Value = accountCreated.id;
    salesorder.customerid.type = EntityName.account.ToString();

    // Create the sales order detail associated with the sales order.
    salesorderdetail salesorderdetail = new salesorderdetail();

    // Set the properties of the sales order detail object.
    salesorderdetail.description = "Test";
    salesorderdetail.owninguser = new UniqueIdentifier();
    salesorderdetail.owninguser.Value =   user.UserId;

    // Create the target object for the request.
    TargetCompoundSalesOrder target = new TargetCompoundSalesOrder();

    // Set the properties of the target object.
    target.SalesOrder = salesorder;
    target.SalesOrderDetails = new salesorderdetail[1] {salesorderdetail};

    // Create the request object.
    CompoundCreateRequest create = new CompoundCreateRequest();

    // Set the properties of the request object.
    create.Target = target;

    // Execute the request.
    CompoundCreateResponse created = (CompoundCreateResponse) service.Execute(create);


    Muhammad Ali Khan
    http://malikhan.wordpress.com
    Friday, May 28, 2010 11:33 AM
  • I think I did not explained my need very well ,
    So i need that  after the Closing ticket I will automatically generate the Fullfill of salesorder as described in the following diagram

     

    Hebergement gratuit d image et photo
    Friday, May 28, 2010 1:58 PM
  • You can program plug-in against incident's SetState/SetStateDynamic message, and fulfill the related salesorder in the plug-in code. 

    This url has code which fulfills a salesorder. 


    Daniel Cai | http://danielcai.blogspot.com
    Friday, May 28, 2010 2:31 PM
  • yes, my need is to fulfill salesorder but not manually by clicking in the menu "fullfill salesorder", i want to fullfull salesorder by code

    my need is how fullfull salesorder by code

    thanks

    Friday, May 28, 2010 2:48 PM
  • You will need to write plug-in to do this, which was what I suggested previously. 
    Daniel Cai | http://danielcai.blogspot.com
    Friday, May 28, 2010 2:54 PM
  • yes, you are right, i must do this by a pluguin

    Could you tell me how generate fullful of salesorder from a pluguin ?

    thanks

    Saturday, May 29, 2010 7:07 PM
  • i find the solution

    thanks for you all .

    orderclose

     

    ord = new orderclose();

    ord.salesorderid =

    new Lookup();

    ord.salesorderid.type =

    EntityName.salesorder.ToString();

    ord.salesorderid.Value = the Guid of salesorder

    ;

     

    FulfillSalesOrderRequest salesreq = new FulfillSalesOrderRequest();

    salesreq.OrderClose = ord;

    salesreq.Status = 100001;

     

    FulfillSalesOrderResponse salesresp = (FulfillSalesOrderResponse)crmservice.Execute(salesreq);

    Sunday, May 30, 2010 5:20 PM
  • Glad to know that you have found the solution. I am sorry that I was not able to respond sooner, just got too busy recently to get into details here. 
    Daniel Cai | http://danielcai.blogspot.com
    Tuesday, June 1, 2010 6:52 PM