web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Supply chain | Supply Chain Management, Commerce
Suggested Answer

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

(0) ShareShare
ReportReport
Posted on by 4

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.   

I have the same question (0)
  • Suggested answer
    Leonard Yang Profile Picture
    10 on at

    Hi AeyPKA,

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

    www.yammer.com/.../

  • Suggested answer
    Ramshenkar Profile Picture
    Microsoft Employee on at

    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.

  • pka Profile Picture
    4 on at

    Hi Leonard

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

  • pka Profile Picture
    4 on at

    Hi Ram Shenkar

    Thank you.  I'll try that.      

  • Guanghui Profile Picture
    Microsoft Employee on at

    Code has delivered to customer through email

  • Suggested answer
    Guanghui Profile Picture
    Microsoft Employee on at

     // 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();

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Meet the Microsoft Dynamics 365 Contact Center Champions

We are thrilled to have these Champions in our Community!

Congratulations to the April Top 10 Community Leaders

These are the community rock stars!

Leaderboard > Supply chain | Supply Chain Management, Commerce

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 143 Super User 2026 Season 1

#2
Abhilash Warrier Profile Picture

Abhilash Warrier 102 Super User 2026 Season 1

#3
Laurens vd Tang Profile Picture

Laurens vd Tang 96 Super User 2026 Season 1

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans