Get Entity as result of Rollup - Anyone has an idea or kludge to do it? RRS feed

  • Question

  • All, I have a problem with Dynamics CRM 2015 regarding Rollup:

    With Rollup fields you can obtain summary information that is quantitative, but how do you get entities?

    Here's a scenario: Suppose you have an custom entity that records 'change orders' for orders from your customers. This entity represents or creates a document that specifies what has changed for the order from the customer.

    Now, you can think of several rollup fields that the customer account could have regarding the change orders: For example the total number of change orders, and here's my challenge: lets say you want to know the date of the LAST change order entered.

    Well, to find the date is easy. That is a MAX rollup on the create date of the change orders.

    However, What I would like to display at the ACCOUNT/Customer level, is not the date of the LAST change order but I would like to have a field that contains the ACTUAL change order (lookup) entity link that corresponds to that LAST change order.

    Does anyone have a potential solution to this challenge w/o custom code? - I know it can be done with code, but I was just wondering if anyone in the community may have a code-less alternative?

    Currently I have setup a workflow that triggers on create of the change order that updates a 'last change order' lookup field in the corresponding account. This kind of works, but the problem comes when the last change work order is deleted (in my case this could happen) ... notice now the last change order is 'the one before' or null if any... this I don't have a solution for.

    any creative solutions?

    for the MS folks: it would be great if a rollup can also return the entity corresponding to a max or a min of a rollup.




    Friday, February 19, 2016 9:35 AM

All replies

  • You'll have to use a plug-in to catch the deletion of the record, find the most recent change order date and update the field on the account. 

    Use the "Vote" option if the reply was helpful and "Answer" option if it answered your question. Thank you for helping others find helpful and answered posts!

    Thursday, March 3, 2016 11:38 PM