Forum Discussion

RhondaParriet's avatar
RhondaParriet
Qrew Member
3 years ago

stop a new record creation based on a field value

How can I stop a user from entering a new vacation request if he doesn't have any available?

I have employee directory in one table
Vacation requests in another table

In employee directory I have fields for
Total Hours eligible 
Vacation Time remaining
and a lookup from vacation request table called total time requested 

In vacation requests I have a summary field of # of vacation request (total time)
Time requested and lookup fields for total time eligible, total time remaining

The the vacation request table, I want to stop the user from entering another request for paid time off if his eligible time is zero.  He can still request unpaid time that would need to be approved.  
















------------------------------
Rhonda Parriet
------------------------------
  • AustinK's avatar
    AustinK
    Qrew Commander
    Do you have a dropdown or anything to select a different type of request? Like one that had PTO/Vacation and another entry for Unpaid?

    If you had that then you could use a form rule or table custom data validation to prevent the user from saving the record. For the form rule you would want to do 'when the record is saved, and if the Request Type(or whatever you have) is for PTO/Vacation and they have less than 1 hour available, or less than half an hour, whatever your limit is, abort the save. Then give a reason for the abort.

    Here is something about custom data validation. https://help.quickbase.com/user-assistance/custom_data_rules.html

    The custom data rules give you a lot more flexibility than the form rule does. These should also work if the user is adding things that are not from a form as well, whereas form rules only work on the form itself.

    If(

    [Request Type] = "PTO/Vacation" and [Vacation Time remaining] < 1,

    "You do not have enough PTO available to make this request, please submit this as Unpaid time off."

    )

    Something like that should work but you may need to jiggle it around a bit to get where you want.
  • You can probably do this with a form rule.

    When the record it saved
    and the employee has no vacation left
    and the request type is paid vacation

    then abort the save with a message saying sorry you don't have any more vacation time left.



    ------------------------------
    Mark Shnier (YQC)
    mark.shnier@gmail.com
    ------------------------------