locked
First plug-in RRS feed

  • Question

  • I am looking at writing a plug-in, I assume this is what I need to do the following:

    * When quote is activated, a query searches for all the products on the quote.

    * The products are then searched to create a text string of all of their parent product groups.

    I can do this with Javascript, but I can't work out how to fire it upon quote activation so this has led me to look at plug-ins.

    Am I on the right lines or is there a way to fire this javascript off on quote activation?

    Second question is I have done the usual google search for how to get started, have looked at the SDK also, but am struggling to understand it all - can someone point me either in the right direction to start this or to a basic example of a plug-in for 2011?

    regards,

    Matt

    Monday, June 23, 2014 3:10 PM

All replies

  • Hi,

    You could do it either with JS and Plugin. But I am afraid that the JS method could be unsupported. You could change the behavior of the activate button on the form to add your desired business, but it is not recommended and is unsupported. The better way as you said is to use the plugin on the "update" of the quote. The update message could fire your plugin and you could check for the input parameters for the status and status reason, and add you business...

    To start the plugin development the best reference is the SDK, but I agree that it could be complicated for the start. So I recommend to read this sample. You could also find more documentations on this link.


    Persian Dynamics CRM Community | انجمن متخصصان فارسی زبان

    Tuesday, June 24, 2014 8:16 AM
    Moderator
  • Thanks for the reply.

    Am still struggling and all the googling I am doing is just making it worse lol.

    I guess I need an example of a plugin that queries for all the products on a quote, then for each of these products it passes the product guid to another query which queries the product table - this would provide the starting point for me.

    regards,

    Matt

    Monday, June 30, 2014 3:55 PM
  • Hi Matt,

    Please refer following video to see if this gets you started on this..

    https://www.youtube.com/watch?v=kwwu84Ji_nw

    MayankP
    My Blog
    Follow Me on Twitter

    Monday, June 30, 2014 8:44 PM
    Answerer
  • That video helps a lot, however I am struggling at the line:

    using (CRMDemoContext orgcontext = new CRMDemoContext(service))

    What is the CRMDemoContext?

    regards,

    Matt

    Wednesday, July 2, 2014 12:24 PM
  • Got it now, it's from the crmsvcutil.exe file.

    regards,

    Matt

    Wednesday, July 2, 2014 1:45 PM
  • Now I need to work out how to convert the following query to LINQ:

    SELECT dbo_FilteredQuote.name, dbo_FilteredProduct.orb_parentproductidname

    FROM (dbo_FilteredQuote INNER JOIN dbo_FilteredQuoteDetail ON dbo_FilteredQuote.quoteid = dbo_FilteredQuoteDetail.quoteid) INNER JOIN dbo_FilteredProduct ON dbo_FilteredQuoteDetail.sp_sellingproductid = dbo_FilteredProduct.productid

    GROUP BY dbo_FilteredQuote.name, dbo_FilteredProduct.orb_parentproductidname

    HAVING (((dbo_FilteredQuote.name)="QUO-01694-D9H2"))

    ORDER BY dbo_FilteredQuote.name;

    Any ideas?

    Matt

    Wednesday, July 2, 2014 3:40 PM
  • I have converted the above to LINQ:

    var _results = (from quote in orgcontext.QuoteSet
                    join qd in orgcontext.QuoteDetailSet on quote.QuoteId equals qd.QuoteId
                    join prod in orgcontext.ProductSet on qd.sp_SellingProductId equals prod.ProductId
                    where (quote.Name == "QUO-01694-D9H2")
                    select prod.orb_ParentProductid).Distinct(); 


    But I am getting an error at the second line - the error being 

    Error 1 The type of one of the expressions in the join clause is incorrect.  Type inference failed in the call to 'Join'.

    Any help?

    regards,

    Matt

    Wednesday, July 9, 2014 10:38 AM
  • Got it to stop showing errors:

     var _results = (from quote in orgcontext.QuoteSet
        join qd in orgcontext.QuoteDetailSet on quote.QuoteId equals qd.QuoteId.Id
        join prod in orgcontext.ProductSet on qd.sp_SellingProductId.Id equals prod.ProductId
        where (quote.Name == "QUO-01694-D9H2")
        select prod.orb_ParentProductid).Distinct();

    regards,

    Matt

    Wednesday, July 9, 2014 2:56 PM