How could I validate field values on client side?

Since we could prevent users from adding a new past calendar event.
How could I add the validation rule before saving a new record?

In my case, I have a record with date value. the new record will be saved once a user click the custom button which will trigger save-model events

I need to make sure the datetime value is great than now. How could I do that?
Any documentation?

Thanks so much.

Hi Poc,

It might be possible to use a branch in your save action, that checks if the datetime value is greater-than or equal to “now.” You would need to set up a formula to evaluate this on the branch action. If the formula evaluates to true (in other words, if the event datetime is > now, then the action sequence could be set up to run further actions, like saving the changes in your model. You could then set up a second branch that uses the opposite formula; if the event datetime is < now, run a separate set of actions, like blocking the UI and showing a message like “Event date can’t be in the past.”

It could look something like (NOW() > {{$}}), which would evaluate to true if the user chose an event_time__c in the future. The specifics will depend on what your models and fields look like.

To set up the formula, you can review our documentation here:

and to learn more about how the branch actions work, take a look at the highlighted sections of our Action Framework documentation:

Edit: You may also need to read about merge syntax and global merge variables to understand how to refer to fields when using formulas.

Hope this helps!

Extremely appreciate your answer. Will look into it.

There’s a usability issue when adopt your solution.
It seems the save-actions will be triggered only if the MeetingSchedule model has been updated. However, there are more models dependent to the MeetingSchedule model.

When the dependent models changes I also wanna trigger the save action.
But now It’s not working.

any idea?

I believe you can set up a model action on the dependent model that will trigger other desired save actions whenever the dependent model is saved.

Hi Mark,
Sorry for letting you misunderstood.
My point is That is I could NOT save the model D if I haven’t update model A.
This issue happens when I applied the branch solution.
Is there any workaround can let me update the B,C,D values without changing model A data?
Thank you so much.

I think I understand. If you want this action sequence to always save b c and d, regardless of what happens in the branch, you can just put the save actions for b, c and d outside the branch, and after it. They’ll then be run even if the branch evaluates to false. you’ll need to run the save actions for b, c, and d before the branch.

Edit: I’ve stricken through an incorrect statement, and corrected it. For the best explanation and full context of these features, I’d always recommend consulting the documentation, which I had linked earlier in this conversation.

Thanks for your point out. Somehow, B C D still rely on A. All the data will be saved if the branch is TRUE. the condition is determined by A’s data.

Update: if I moved out the b,c,d out of the IF branch. Then, the result will be INCORRECT. because I don’t want to save any change if the BRANCH A condition is not satisfied.

Is your goal to only make A part of the branch? And B, C, and D should happen every time the action sequence runs? I misspoke in my previous comment about whether the actions after the branch will run.

  • If the formula is true , then the If-True actions connected to this branch will occur— ignoring any actions listed after the branch action in the Action Framework sequence.
  • If the formula is false , Skuid will skip the branch—and all actions listed within it_—_and proceed with any actions listed after the branch.
    To illustrate, look at this screenshot. If the branch action’s formula evaluates as true, then Model A will be saved, and the other actions beneath will not run. If the branch evaluates to false, then the other actions below, saving models B, C and D should run instead.

If you want models B, C and D to be saved every time this action sequence fires off, and ONLY model A should be affected by the branch being true/false, then you might be able to set up the sequence like this. In this sequence, nothing above the branch is affected by the branch being true or false. Sorry for any confusion!

it makes more sense for your detailed explanation. Thanks so much. 
If we can always trigger the “IF BRANCH” even the condition is not changed on that context model. Things will be more easier :slight_smile: