Skip to main content

Notifications

Announcements

No record found.

Supply chain | Supply Chain Management, Commerce
Suggested answer

How to pass selected sales transaction line in shopping cart to CRT

Posted on by 2

I have a prospective scenario. The solution is about to create a new operation and pass the selected sales transaction line in shopping cart as parameter to the new operation.

Example behavior:

Reference to the "View available discounts" operation. The process is, to choose an item in cart and click the operation button, The command "GetAvailablePromotionsServiceRequest" has "SalesTransaction" object as parameter. I would like to do the same behavior.

SalesTransaction salesTransaction = new SalesTransaction();
salesTransaction.CartType = CartType.Shopping;
salesTransaction.SalesLines.Add(ConstructSalesLine("888842543067"));
CalculatePricesServiceRequest request = new CalculatePricesServiceRequest(salesTransaction);
GetPriceServiceResponse response = runtime.Execute<GetPriceServiceResponse>(request, new RequestContext(runtime));

GetAvailablePromotionsServiceRequest getAvailablePromotionsServiceRequest = new GetAvailablePromotionsServiceRequest(salesTransaction);
GetAvailablePromotionsServiceResponse getAvailablePromotionsServiceResponse =
requestContext.Execute<GetAvailablePromotionsServiceResponse>(getAvailablePromotionsServiceRequest);

Questions: - 

1. Is there any examples in RetailSDK\Document to pass the selected sales cart as parameter to CRT?
2. If no example, please kindly guide the command in Cloud POS and CRT.   

  • Suggested answer
    Guanghui Profile Picture
    Guanghui on at
    RE: How to pass selected sales transaction line in shopping cart to CRT

     // Try to load the transaction

                   var getCartRequest = new GetCartRequest(

                       new CartSearchCriteria(cartId, cartVersion),

                       QueryResultSettings.SingleRecord,

                       includeHistoricalTenderLines: false,

                       ignoreProductDiscontinuedNotification: null);

                   var getCartResponse = context.Execute<GetCartResponse>(getCartRequest);

                   return getCartResponse.Transactions.SingleOrDefault();

  • Guanghui Profile Picture
    Guanghui on at
    RE: How to pass selected sales transaction line in shopping cart to CRT

    Code has delivered to customer through email

  • pka Profile Picture
    pka 2 on at
    RE: How to pass selected sales transaction line in shopping cart to CRT

    Hi Ram Shenkar

    Thank you.  I'll try that.      

  • pka Profile Picture
    pka 2 on at
    RE: How to pass selected sales transaction line in shopping cart to CRT

    Hi Leonard

    Thank you.  I'll join the group & try.  

  • Suggested answer
    Ramshenkar Profile Picture
    Ramshenkar on at
    RE: How to pass selected sales transaction line in shopping cart to CRT

    You can get the current cart in POS typescript code by implementing the cart controller. It will provide the current cart and selected cart lines. You can customize or change CartViewController.ts file as per your requirement and refer in your custom operations handler in POS.

    Refer sample extension :  RetailSDK\POS\Extensions\SampleExtensions\ViewExtensions\Cart\CartViewController.ts

    Documentation :

    docs.microsoft.com/.../cart-view-handlers

    In case you want the current cart in CRT you need transaction id to get the current cart details. You can fetch the transaction details using GetSalesTransactionDataRequest. In most of the CRT request you can get transactionid.

    Hope this answer your question.

  • Suggested answer
    Leonard Yang Profile Picture
    Leonard Yang 10 on at
    RE: How to pass selected sales transaction line in shopping cart to CRT

    Hi AeyPKA,

    You can post your question to Yammer. May get more ideas from other experienced engineers.

    www.yammer.com/.../

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,269 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,198 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans