Is this calculated attribute set as "AfterRead"? If so, this doesn't actually write anything to the database, but will still display something. I am wondering if your PASS, FAIL etc displays the correct information in the query results, but perhaps grouping is actually polling the database...? It's just a thought...
Ah... yes it is...
Should it be a Before Save then? I wasn't really sure on the difference but it seemed to be showing stuff on the record!
It's probably worth a try to change it to BeforeSave, although I'm unsure when/where you want it to be calculated. It can't hurt to try though I guess.
As I mentioned, I'm not 100% sure that this is the cause though, but it seems a possibility. Have a look in the sql db table for this attribute, and see if there is any data contained in the field.
I also should mention, that you cannot sort on a calculated attribute, and so this may well apply to grouping on them also. One way around this may be to use a copy rule to another (non-calculated) attribute.
Just to confirm Paul is correct on this. After Read calculations are limited in their use because they are processed "on the fly" for display purposes only. More complex actions like sorting, grouping, etc. are done at a lower level before the calculation is dealt with.
You should change it to a Before Save, however you will need to add at least one "depedency" to the calculation and from now on the calculation will only get processed (and save the value to the database) when one of its dependencies gets set/changed. This is the best practice anyway as it significantly reduces the number of times the calculation itself needs to be processed.
It was set up as an after read calculation, I picked up from the community that this might be causing me an issue, however I then changed to a before save calculation and am still getting problems, it is now not populating data if I have a dependency set, or if I don't set up a dependency the attribute doesn't update.
I have tried setting the attribute up on the Escalation Point object & Incident object and neither seem to work as required.
The calculation is below. I will explain what I am trying to achieve after and maybe you can see where I am going wrong?
static def GetAttributeValue(EscalationPoint):
Value1 = 'PASS'
Value2 = 'FAIL'
Value3 = 'OPEN'
Value4 = 'NON KPI METRIC'
if EscalationPoint.Title == 'Email & Self Service' and EscalationPoint.Status == 'Completed': return Value1
if EscalationPoint.Title == 'Email & Self Service' and EscalationPoint.Status == 'Cancelled': return Value1
if EscalationPoint.Title == 'Email & Self Service' and EscalationPoint.Status== 'Expired': return Value2
if EscalationPoint.Title == 'Email & Self Service' and EscalationPoint.Status == 'Open': return Value3
if EscalationPoint.Title != 'Email & Self Service': return Value4
Basically, the calculation is to analyse whether incidents that are logged by auto email or self service are responded to within a 30 minute SLA. The reason I can't just look at the Status is that when an incident is logged by mail or self service the response level is set at the 30 minute response by the template, which is over written by the SLA Matrix once it has been responded to (the category, urgency & impact set the SLA). The only exception to this is Quarantined Mail Release requests, which stay on the 30 minute response level.
The calculation logic above is correcr, I just can't see why it isn't populating as expected...