How to Extract Quoted Line Items Data

I would like to utilize the REST API to extract QLI data. I need the related Quote to be exposed as well as the individual QLIs. 

I have a working Webhook where Quote header data is pushed to on external system using a specific trigger in Sugar. That data creates a sales order in our ERP. 

I require the QLI data to accompany that Quote data when pushing to the ERP. 

How do I go about doing that?

Thanks, 

SL

Parents
  • Once you have a quote bean id you can retrieve the related products using the link name and the related module api:

    GET /<module>/:record/link/:link_name

    https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_11.2/Integration/Web_Services/REST_API/Endpoints/modulerecordlinklink_name_GET/

    Quoted Line Items is a little tricky because the name of the module is actually "Products".

    The link name for quoted line items is "products"

    therefore

    /Quotes/<the quote bean id>/link/products 

    will get you all the products on the Quote.

    For example: 

    /Quotes/b63eb8a0-80c2-11ea-862d-001a4a160206/link/products

    will get all products related to the quote with that id.

    Note:

    When I need to find the name of a relationship (link) I generally go to the cache of the module

    So I went to 

    cache/modules/Quotes/Quotevardefs.php

    I searched for the module name "Products" and found the definition of the one-to-many relationship:

        'quote_products' =>
        array (
          'lhs_module' => 'Quotes',
          'lhs_table' => 'quotes',
          'lhs_key' => 'id',
          'rhs_module' => 'Products',
          'rhs_table' => 'products',
          'rhs_key' => 'quote_id',
          'relationship_type' => 'one-to-many',
        ),
    

    From the relationship name "quote_products" I found the definition of type = link for products and hence the link name.

        'products' =>
        array (
          'name' => 'products',
          'type' => 'link',
          'relationship' => 'quote_products',
          'vname' => 'LBL_PRODUCTS',
          'source' => 'non-db',
        ),
    

    FrancescaS

Reply
  • Once you have a quote bean id you can retrieve the related products using the link name and the related module api:

    GET /<module>/:record/link/:link_name

    https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_11.2/Integration/Web_Services/REST_API/Endpoints/modulerecordlinklink_name_GET/

    Quoted Line Items is a little tricky because the name of the module is actually "Products".

    The link name for quoted line items is "products"

    therefore

    /Quotes/<the quote bean id>/link/products 

    will get you all the products on the Quote.

    For example: 

    /Quotes/b63eb8a0-80c2-11ea-862d-001a4a160206/link/products

    will get all products related to the quote with that id.

    Note:

    When I need to find the name of a relationship (link) I generally go to the cache of the module

    So I went to 

    cache/modules/Quotes/Quotevardefs.php

    I searched for the module name "Products" and found the definition of the one-to-many relationship:

        'quote_products' =>
        array (
          'lhs_module' => 'Quotes',
          'lhs_table' => 'quotes',
          'lhs_key' => 'id',
          'rhs_module' => 'Products',
          'rhs_table' => 'products',
          'rhs_key' => 'quote_id',
          'relationship_type' => 'one-to-many',
        ),
    

    From the relationship name "quote_products" I found the definition of type = link for products and hence the link name.

        'products' =>
        array (
          'name' => 'products',
          'type' => 'link',
          'relationship' => 'quote_products',
          'vname' => 'LBL_PRODUCTS',
          'source' => 'non-db',
        ),
    

    FrancescaS

Children