Using an ASP file to replace the Export to Word

  • Hello!

    I need to get context-specific field values and map them in an ASP file instead of creating a template linked with the Export a quote to Word. For system reasons, the Epoxrt to Word from CRM is not an option.

    The project - Display the quote in a tab in the Quotes Tabs - formatted for our clients' eyes. From there, we will print a range of the page to a PDF and email said PDF as an attachment from CRM.

    Not only is this visioned as a great work around for our MS Word issue, we feel it will be a cleaner/better way for our reps to work. Fewer steps/staying in the walls of CRM/no outside software interaction/less tax on the server.

    I have used the forum pieces and manuals to put code together.

    The problem - I cannot get individual field values, in context, to show up on the page in the tab. When I create the block in ASP, the "fixed" data moves down the page, making me think the code works for calling the block, but does not grab my get context code.

    Please have a look and advise. This code is for just one of the fields.

    <% - include files, etc....

    ThisQuoteID = CRM.GetContextInfo('Quotes', 'Quot_OrderQuoteID');

    SearchSQL = "Quot_reference="+ ThisQuoteID;

    Bbbbb = CRM.GetBlock('Content');

    CRM.AddContent(Bbbbb.Execute(SearchSQL));

    Response.Write(CRM.GetPage));

    %>

    Thanks

     

  • Hi,

    The usual way of displaying a record on-screen would be to create a custom screen within the interface (Administration -> Customisation -> Entity -> Screens), then add it to a page using AddBlock(). There's lots of good info on doing this here, with a specific example here. This will preserve the CRM look and feel, and also make it easy to add default buttons (Change, Save etc), as well as saving you from having to mess about with HTML formatting.

    Of course, you don't have to display information that way if you don't want to. If you just want to pull back the current record in context (as I understand you're trying to do), then manipulate it whatever way you like, you can do something like this: 

    
    <!-- #include file ="sagecrm.js" -->
    <%
    var ThisQuoteID = CRM.GetContextInfo('Quotes', 'Quot_OrderQuoteID');
    var ThisQuote = CRM.FindRecord("Quote", "Quot_OrderQuoteId="+ThisQuoteID);
    
    var QuoteItemRecords = CRM.FindRecord("QuoteItems,vLineItemsQuote", "QuIt_OrderQuoteId="+ThisQuoteID);
    
    CRM.AddContent("<p>"+ThisQuote.Quot_reference+" - "+ThisQuote.Quot_Description+"</p>");
    
    var contentString = "<table border=1><tr><td>";
    contentString+= CRM.GetTrans("ColNames", "prod_name")+"</td><td>"+CRM.GetTrans("ColNames", "QuIt_quantity");
    contentString+= "</td><td>"+CRM.GetTrans("ColNames", "QuIt_QuotedPrice")+"</td></tr>";
    
    while (!QuoteItemRecords.Eof) {
    
        contentString+= "<tr><td>"+QuoteItemRecords.prod_name+"</td><td>";
        contentString+= QuoteItemRecords.QuIt_quantity+"</td><td>"+QuoteItemRecords.QuIt_QuotedPrice+"</td></tr>";
        QuoteItemRecords.NextRecord();
    }
    contentString+= "</table>";CRM.AddContent(contentString);
    Response.Write(CRM.GetPage());
    %>
    


    This will display the current quote record and its associated order items in a table.

    If you intend doing a large amount of customisation / development then it may be worthwhile looking into becoming a Sage CRM development partner - further details are available on this site.
     
    Thanks
    Rob

     

  • Investing in the DPP is something I am sure we will consider if we have other custom projects.

    This help was huge - thanks!