Calculated Field - MaxRelatedDate Function Issue

Hello All,

I have been trying for sometime to use the MaxRelatedDate to return the latest meeting that has been created within Meetings module.

In terms of relationship, Meetings are linked to my Opportunity module in 1-to-M relationship. So, within opportunity module, I am creating a calculated field which will count the days between latest meeting and today:

Calculated Field Formula = daysUntil(maxRelatedDate($meetings,"date_start"))

Not sure, what I am missing here. I have used different combinations like copying the Meeting Start Date into a different field within Meeting record itself and referring to that field in Opportunity calculated field.

But this maxRelatedDate function doesnt yield any result. 

Would be of much help, if someone could provide some work arounds or solves here.

Regards - AP

Parents
  • Have you added any additional Opportunity/Meeting relationships to your system, or are you just using the core relationship? If you've added a new relationship, the link name ("$meetings"), will be different, and could explain why the data is not being populated correctly. To get the correct link name, when in the formula builder part of Studio, click "Related", and it will show a list of all relationships, and you'll probably see two relationships for Meetings. If you select one, you'll get $meetings - and if you select the other, you'll get the other relationship link name. Use that link name instead of $meetings and your formula will likely work.

    Let's suppose that no new relationships have been added - I would suggest starting with a more basic field "last meeting", and make it just maxRelatedDate($meetings,"date_start"). I created that exact field, added to a layout, and can see it being populated correctly (I'm on a clean v10.1.0 system)

    Once you do have the formula working, there'll still be another challenge to solve for - the calculation of the days. SugarLogic only recalculates when a record is updated, so when you view the same record the following day, you won't see the number field incremented by 1 until you trigger a save (or select the record via ListView and hit "Recalculate SugarLogic"). This requires either manual effort, or some additional piece of automation/code to address. If you think that the product should do this out of the box, please vote up this Idea here: sugarclub.sugarcrm.com/explore/sell/i/product-suggestions/scheduled-job-which-triggers-recalculation-of-sugarlogic-fields

Reply
  • Have you added any additional Opportunity/Meeting relationships to your system, or are you just using the core relationship? If you've added a new relationship, the link name ("$meetings"), will be different, and could explain why the data is not being populated correctly. To get the correct link name, when in the formula builder part of Studio, click "Related", and it will show a list of all relationships, and you'll probably see two relationships for Meetings. If you select one, you'll get $meetings - and if you select the other, you'll get the other relationship link name. Use that link name instead of $meetings and your formula will likely work.

    Let's suppose that no new relationships have been added - I would suggest starting with a more basic field "last meeting", and make it just maxRelatedDate($meetings,"date_start"). I created that exact field, added to a layout, and can see it being populated correctly (I'm on a clean v10.1.0 system)

    Once you do have the formula working, there'll still be another challenge to solve for - the calculation of the days. SugarLogic only recalculates when a record is updated, so when you view the same record the following day, you won't see the number field incremented by 1 until you trigger a save (or select the record via ListView and hit "Recalculate SugarLogic"). This requires either manual effort, or some additional piece of automation/code to address. If you think that the product should do this out of the box, please vote up this Idea here: sugarclub.sugarcrm.com/explore/sell/i/product-suggestions/scheduled-job-which-triggers-recalculation-of-sugarlogic-fields

Children