Is it possible for a snippet to retrieve quote line items from quote?

  • 1
  • Question
  • Updated 5 years ago
Is it possible to write a snippet to retrieve quote line items from a quote? The page contains
only Quote Model and a related task table. I would like to copy all quote line item details into a new task description field?
Photo of Jaust

Jaust

  • 462 Points 250 badge 2x thumb
  • unsure

Posted 5 years ago

  • 1
Photo of Jaust

Jaust

  • 462 Points 250 badge 2x thumb
Guys, I figured this out and was able to accomplish this using the ChildRelationship tutorial.
I am yet to see what Skuid cannot accomplish. Great work guys.

I am attaching the code just for others help.

var field = arguments[0],
        value = arguments[1];

    var quoteId = skuid.page.params.QuoteId;
    var quoteModel = skuid.model.getModel('QuoteData');
    var quote = quoteModel.getRowById(quoteId);
   
    var dt = field.metadata.displaytype;
    if (field.mode != 'edit') {
        skuid.ui.fieldRenderers[dt][field.mode](field,value);
    } else {
        skuid.ui.fieldRenderers[dt].edit(field,value);
    }
   
    var tmpDesc = '';
    for(i=0;i<quote.QuoteLineItems.totalSize;i++)
    {
        var qli = quote.QuoteLineItems.records[i];
        tmpDesc = tmpDesc + qli.Description + '\n' + qli.Quantity + '\n' + qli.UnitPrice + '\n' + qli.TotalPrice + '\n\n';
    }
    if(value==null){
      field.model.updateRow(field.row,'Description',tmpDesc);
     
      if(field.mode=='edit')
      field.element.find('input').val(tmpDesc);
    }

Photo of Rob Hatch

Rob Hatch, Official Rep

  • 44,006 Points 20k badge 2x thumb
Glad we were able to help.   I was also going to point you to a tutorial where we mass create statements for every contact on an account.  This pulls all the contacts (Children of the account) and creates new statements records for each one.   Lots of concepts are the same:  http://help.skuidify.com/s/tutorials/m/components/l/109496-mass-create-records

Here is shameless request.  We'd love it if you'd copy your second line above as a  review on the app exchange...  Here is the link: https://appexchange.salesforce.com/listingDetail?listingId=a0N30000009wyDjEAI 

Thanks again!
Photo of Jaust

Jaust

  • 462 Points 250 badge 2x thumb
Will definitely post a review as soon as we complete few more pending items in our list
and purchase Skuid Licenses :-)  The only other support of this kind is Rackspace's Fanatic Support,