Coming soon: Your brand new Help Center & Community! Get a sneak-peek here

QuoteAgent - GetQuoteEntityFromSaleId returns empty Quote?

Hi, 

I'm trying to create a CRMScript which is going to add productslines to an existing quote, and think there might be a bug here.

The quoteagent has a method called GetQuoteEntityFromSaleId which accepts a saleId, and is supposed to return a QuoteEntity, but it seems to be like it always returns an empty object.

This CRMScript prints out an empty QuoteEntity object, even when the given saleId has a valid Quote:

Integer saleId = 1669;
NSQuoteAgent quoteAgent;
NSQuoteEntity quoteEntity = quoteAgent.GetQuoteEntityFromSaleId(q.saleId);
printLine("SaleId: "+ quoteEntity.GetSaleId().toString());
printLine("QuoteId: "+ quoteEntity.GetQuoteId().toString());
printLine("ActiveQuoteVersionId: "+ quoteEntity.GetActiveQuoteVersionId().toString());
printLine("GetERPOrderKey: "+ quoteEntity.GetERPOrderKey());

this prints out:

SaleId: 0
QuoteId: 0
ActiveQuoteVersionId: 0
GetERPOrderKey: 

if I change the script to instead use the QuoteId (which belongs to the same saleId) it works:

Integer quoteId = 28;
NSQuoteAgent quoteAgent;
NSQuoteEntity quoteEntity = quoteAgent.GetQuoteEntity(quoteId);
printLine("SaleId: "+ quoteEntity.GetSaleId().toString());
printLine("QuoteId: "+ quoteEntity.GetQuoteId().toString());
printLine("ActiveQuoteVersionId: "+ quoteEntity.GetActiveQuoteVersionId().toString());
printLine("GetERPOrderKey: "+ quoteEntity.GetERPOrderKey());

This prints out: 

SaleId: 1669
QuoteId: 28
ActiveQuoteVersionId: 28
GetERPOrderKey: 

The saleId and quoteId belong together, so ID's are correct.

I assume this is a bug in QuoteAgent.GetQuoteEntityFromSaleId ? I'm using latest 8.4 R03 version.

RE: QuoteAgent - GetQuoteEntityFromSaleId returns empty Quote?

just in case...
In your examplle you refer to q.saleId, not the locally defined Integer.
/conrad

Af: Conrad Weyns 17. nov 2018

RE: QuoteAgent - GetQuoteEntityFromSaleId returns empty Quote?

Ah, pretty sure that is only a copy-paste error when I simplified the example. Will doublecheck later.

Af: Frode Lillerud 17. nov 2018

RE: QuoteAgent - GetQuoteEntityFromSaleId returns empty Quote?

Nevermind, my bad...

Af: Frode Lillerud 17. nov 2018