is it possible to use an aggregate function in wor...
# suiteanalytics
b
is it possible to use an aggregate function in workflow to drive the value of a field? I'm trying to set a status of a customer based on their most recent transaction date. i'm trying something like this (not 100% sure it's right)
CASE WHEN {transaction.type} = 'Sales Order' THEN ROUND({today} - (MAX({transaction.trandate})KEEP(DENSE_RANK LAST ORDER BY {transaction.trandate})) END
. I was trying this in search to see if i could get it to work first before moving to workflow. i know it can be scripted, but i was starting with workflow for maintainability in organization. this isn't complete yet either, essentially if the most recent transaction is within 30 days, then set field value to "super active" else if 31-60 then set to "active" else 61-90 then "passive"... etc. or am i better off just scripting this? thanks!
b
just learned this one, but try the
Date of Last Order
or
Date of Last Sale
filter
b
is that ultimately available in workflow formula? i'm avoiding filters and the "when ordered by" in searches because i can't do that in a workflow formula.
oh geez, you just mean the field value. so
case when sales order then date of last sale end
? I don't know if that will work... i can try it. or even without the case formula i suppose is what you're getting at
b
more as a condition for your workflow
you can use a search
message has been deleted
b
i forgot about the date of last order which seems great, but i can't reference that field via the formula section for workflow set field value action. so i guess it's either scripted or 5 different searches to set 1 value (since we have 5 values). i feel like a script is better for this in that case.
thanks for the thought and the hint in the right direction there.