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

Community site session details

Session Id :
Customer experience | Sales, Customer Insights,...
Suggested answer

Group and order by

(0) ShareShare
ReportReport
Posted on by 105

How do i group order lines by name and get the last created record from each group and clone that line? 

I have the same question (0)
  • Suggested answer
    Amit Katariya007 Profile Picture
    10,409 Super User 2025 Season 2 on at
    RE: Group and order by

    Hello,

    Can you elaborate your requirement more.

    Thank you,

    Amit Katariya

  • sjov Profile Picture
    105 on at
    RE: Group and order by

    Yes.

    I have an order. In that order i have products. Each product has a contract from and to date. For each product I have as many lines as long as the contract is active (for each month) .

    Now, i have to group these products by name and find each product's last created line and clone that line.

  • Suggested answer
    Amit Katariya007 Profile Picture
    10,409 Super User 2025 Season 2 on at
    RE: Group and order by

    Can you share some screenshots if possible. because as per above explanation is it possible that a user can add same product multiple times(Not talking about the quantity but number of product rows)?

  • sjov Profile Picture
    105 on at
    RE: Group and order by

    Yes, its not about the quantity. For example we have a contract for internet that its duration is 12 months. For each month we need to create a new line of the product. That is why we need to find the last created line of each product and based on that to clone that last line for each product. (if the contract is still active of course) IMG_2D00_a00d52f2d5d5e4d85f6c3c2e9c185594_2D00_V.jpg

  • Suggested answer
    Bipin D365 Profile Picture
    28,983 Moderator on at
    RE: Group and order by

    Hello,

    If you want to achieve your requirement using Plugin c# code then please see my blog for Group by usage in Fetchxml

    xrmdynamicscrm.wordpress.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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Abhilash Warrier – Community Spotlight

We are honored to recognize Abhilash Warrier as our Community Spotlight honoree for…

Leaderboard > Customer experience | Sales, Customer Insights, CRM

#1
MVP-Daniyal Khaleel Profile Picture

MVP-Daniyal Khaleel 125

#2
Tom_Gioielli Profile Picture

Tom_Gioielli 121 Super User 2025 Season 2

#3
Erin Lubben Profile Picture

Erin Lubben 73

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans