Last N Days model condition not working

Conlan O'RourkeConlan O'Rourke ✭✭✭✭
edited October 15, 2019 in Questions
I'm trying to have my model create a new row if the most recently created record was more than 15 days ago, because the user needs to create a new record if the most recent record created is more than 15 days old.

I've added a model condition for this purpose (see screenshot attached), and checked off "Create default row if model has none"...thinking that if the model doesn't find a record that meets my condition, it will create a new one... and I've tried all the operators (below) that I would think should do the trick...but I can't seem to get it to work...components tied to the model don't render at all.

CreatedDate = Last n Days: 15
CreatedDate >= Last n Days: 15
CreatedDate > Last n Days: 15

Where am I going wrong...?

image

Comments

  • edited October 15, 2019
    I’ve had similar issues and reported it. The ultimate conclusion was that n days ago is a range not a specific date so comparing it the way you are doesn’t work. What I would do is Crest a Salesforce field that returns true if today minus created date is less than 15 days. Then you can create a condition in your model based on whether that field is true or false.
  • edited October 9, 2017
    Skuidward is correct and the post he is referring to is this:
    https://community.skuid.com/skuid/topics/-next-n-weeks-not-working

    We have it catalogued with our developers and are working on putting out an enhancement.
  • Conlan O'RourkeConlan O'Rourke ✭✭✭✭
    edited September 21, 2018
    Hmmm....this workaround of creating the boolean formula field ((TODAY() - CreatedDate) <= 15) and using it as the condition doesn't seem to be working...when the condition is met...i.e. created in last 15 days, the record pulls up. However, when the condition is not met, the' Create default row if model has none' is not creating a new row.
  • Conlan O'RourkeConlan O'Rourke ✭✭✭✭
    edited October 16, 2017
    I think I may have found something...the condition works when "Load Model data on Page Load" is checked...but not when the model is loaded through an action on the page (in my case an action on the tab). 

    In fact, it's not just the boolean workaround...it seems to work even with the Last_N_Days:15 condition.

    So it appears the issue is with the tab action that Queries the Model rather than the Last_N_Days:15 condition...see links to screencasts below

    Buggy: http://recordit.co/RRtzA5m82b

    Working: http://recordit.co/wSAImiKXX8

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!