locked
is it possible to convert a custom field from quote product to order-product RRS feed

  • Question

  • Hi, 

    I have a custom field in Quote Product called "NEW_PARTY"  and have also added the same field in the Order Product. both have same data type. 

    When I convert the Quote to an Order (ie create a order from the active quote), Is it possible to automatically display the "NEW_PARTY" value from Quote Product to Order Product.  It didn't display for me when I converted from Quote to an Order.  However, if I map these fields between Quote Product and Order Product, will it work? 

    There is no relationship between Quote Product and Order Product (. If I create M2M relationship, will it cause any issues) or what will be the best way to approach. 

    Wednesday, August 31, 2011 2:59 PM

Answers

All replies

  • Hi,

    I do not think that the mapping will work, in this case you have to register a plugin step on Create message of OrderProduct entity in Pre-Operation to fetch the field value from QuoteProducts and then fill in the field of OrderProducts


    Jehanzeb Javeed

    http://worldofdynamics.blogspot.com
    Linked-In Profile |CodePlex Profile

    If you find this post helpful then please "Vote as Helpful" and "Mark As Answer".
    Wednesday, August 31, 2011 3:03 PM
  • Thanks Javeed.  Say I am using the Serve.Retrieve to fetch the QUOTE.NEW_PARTY. How can update the same field in the ORDER PRODUCT. Will it be some thing like,  

    Entity quotedetail = new Entity("quotedetail")

    columset ....

    quotedetail = service.retreive(..);

     

     Entity orderproduct = (Entity)context.InputParameters["Target"];

    orderproduct["new_party"] = quotedetail.Attributes["new_party"].ToString();

     

    and then .. will need to use Service.Create Method, this is where I am not clear. Appreciate your help. 

    Wednesday, August 31, 2011 3:14 PM
  • Hi,

    CRM does not provide facility to map custome field from quote product to order product.

    you can write a plugin on salesorder create and can check for quoteid and fetch quotesdetails's new_party field based on quoteid and update salesorderdetails.

     


    Mahain : MS CRM Freelancer

    Wednesday, August 31, 2011 3:25 PM
    Moderator
  • Hi,

    Yes, you are doing it correctly but you do not need to call service.create method because if you are registering into the plugin Pre-Operation then adding the new_party value will be autamtically saved.


    Jehanzeb Javeed

    http://worldofdynamics.blogspot.com
    Linked-In Profile |CodePlex Profile

    If you find this post helpful then please "Vote as Helpful" and "Mark As Answer".


    • Edited by Jehanzeb.Javeed Wednesday, August 31, 2011 3:28 PM Updated
    • Marked as answer by CRM elite Wednesday, August 31, 2011 3:31 PM
    Wednesday, August 31, 2011 3:27 PM
  • Wednesday, August 31, 2011 4:22 PM
    Moderator
  • Hi Javeed, I have a issue: I am writing the plug-in on pre-operation of order detail. When the quote is converted into order, the plan  is to capture the quote detail ("NEW_PARTY") field and input to the corresponding Order detail ("NEW_PARTY").  

    In the Order Detail pre-op event, I can trace the salesorderid, quoteid but not the quotedetailid? 

    I can query the quote detail based on the quoteid but then i get a quotedetail collection. Is there any other fields such as line item # or some sort whereby we can identity which quotedetail will map to the orderdetail?  

     

    Saturday, September 17, 2011 1:20 PM
  • since I have many other plug-ins in saleorder and invoice! So I would need to make sure that the update event caused by the "NEW_PARTY" not affect the other plug-ins that are registered for the update events (pre & post). What is the best practice
    Saturday, September 17, 2011 1:25 PM
  • I've personally performed the custom attribute mapping by accessing the hidden mapping relationship, the way Jamie describes.  It works, and it's a lot easier than using a Plugin.  Marking that as an answer to this thread as well.
    Dave Berry - MVP Dynamics CRM - http:\\crmentropy.blogspot.com Please follow the forum guidelines when inquiring of the dedicated CRM community for assistance.
    Saturday, September 17, 2011 1:32 PM
    Moderator
  • Thanks David. I appreciate it. Just to clarify, if I need to generate the mapping for quotedetail to orderdetail, then I would change the jscript 

    " <q1:Value xsi:type=\"xsd:string\">salesorderdetail</q1:Value>" +

    to reflect for quotedetail. Correct? 

    Could I need to run this script on orderdetail form event? or could I use any form event? 

    Thanks 

    Saturday, September 17, 2011 2:24 PM
  • Hi Javeed, I have a issue: I am writing the plug-in on pre-operation of order detail. When the quote is converted into order, the plan  is to capture the quote detail ("NEW_PARTY") field and input to the corresponding Order detail ("NEW_PARTY").  

    In the Order Detail pre-op event, I can trace the salesorderid, quoteid but not the quotedetailid? 

    I can query the quote detail based on the quoteid but then i get a quotedetail collection. Is there any other fields such as line item # or some sort whereby we can identity which quotedetail will map to the orderdetail?  

     

    Hi,

    The line number field (system created) in the QuoteDetail entity does not populate automatically, either user can fill that field or you can write a plugin that  will automatically increment the line number into the QuoteDetail entity on record creation or even you can create a new workflow that will increment the lineNumber value into the QuoteDetail record. After having linenumber you can retrieve the NEW_PARTY field from QuoteDetail by QuoteId and LineNumber .

    If you have registered your plugin step on Pre-Operation create record and updating the context passed entity object attributes then it will not affect the other plugins execution or will not cause any other plugin event to trigger. If you want to your plugin to execute before/after the execution of any other plugin then you change your plugin registration step Execution Order (http://msdn.microsoft.com/en-us/library/hh237515.aspx


    Jehanzeb Javeed

    http://worldofdynamics.blogspot.com
    Linked-In Profile |CodePlex Profile

    If you find this post helpful then please "Vote as Helpful" and "Mark As Answer".
    Saturday, September 17, 2011 2:52 PM
  • Jamie, Thank you. This is fantastic. Works like a charm.
    Saturday, September 17, 2011 3:29 PM
  • Oh, and yes, you just need to specify the schema name of the entity you want to surface all mappings for.  You can map this way all the way from opportunity product to quote product to order product to invoice product if you wanted to. :)
    Jamie Miley
    Check out my about.me profile!
    http://mileyja.blogspot.com
    Linked-In Profile
    Follow Me on Twitter!
    • Proposed as answer by Jamie MileyModerator Saturday, September 17, 2011 4:55 PM
    • Marked as answer by CRM elite Monday, September 19, 2011 2:08 PM
    Saturday, September 17, 2011 4:55 PM
    Moderator