Accounts Payable BO (hereafter AP)
Scheduled Payment Date (hereafter thedate)
AP.Status can be: New, Scheduled, ReadyToPay, Paid
At some point, a user fills in thedate with a future value for when they want to pay this note.
A morning process finds all Scheduled statuses with thedate=today and updates the status to “ReadyToPay”
The issue surrounds all the ‘code’ needed to allow editing of thedate and when.
Until the AP is Paid, thedate can be edited.
By default, it would just be a field on the screen, with rules in the BO.
IF thedate WAS CHANGED AND thedate is more than 60 days out, or is in the past THEN REPORT ERROR
IF OLD(thedate) is UNDEFINED and thedate is DEFINED (this means someone entered a new date) THEN log this. And SET status = Scheduled.
IF OLD(thedate) is DEFINED and thedate is DEFINED (this means someone changed the prior date) THEN log this.
IF OLD(thedate) is DEFINED and thedate is UNDEFINED (clearing the date) THEN log this.
- “log this” means add it to an audit trail
This is just for ONE date field. An A/P note may not be that big of a BO, but your primary BOs may have lots of fields and lots of rules already.
Thankfully, when Presentation Rules allowed conditional READ ONLY access several years ago, the form itself can limit editing… Like if the status is Paid, the field is Read Only. This saves having to add more RULES by checking things in the Form.
But an approach I sometimes like to take is to have a button on the FORM to activate a function/process rather than just editing the field.
Next to thedate, I’d have a button “Set Payment Date” which starts a process (can force a SAVE or it will ask).
Now I can run some logic before editing… and/or throw a message to the user.
Popup a form to collect the date. The Form could have an explicit “Clear Date” button.
After SAVE I can run more logic and use a REPORT ERROR. Do my logging. Ultimately save the new value and return to the main Form which can redraw based on a trigger.
SIDEBAR NOTE: One annoying thing about screen layouts in Aware is that you can’t [easily] add a button to the right of a field to say “Set Payment Date”. It can only be in an HTML/Button cell. (up to v9). Problem there is you have to know ahead of time to allocate that extra column to hold the button(s). And they won’t actually be “right next to” your field since they will be in the next column. If you design a busy screen then have to come back later (maybe the users needed new functionality) and add columns and shift everything over its a pain. While I haven’t tried it, it would be nice to, with a JS Render script, arbitrarily add a button anywhere on the screen to the right of a control. –OR– When you edit a field on a Form, nothing usually goes in the Script property. Maybe someone could figure out a way to “innerHTML” some code onto the end of that field to make a button appear????
So, my question is how do you handle simple field and status changes in your app.
Similarly, do you have a BO with a Status Field (New, In Progress, Cancelled, Shipped, Paid, Closed, etc.). Do you allow users to change STATUS values by selecting the Status in the Dropdown or lock that down and only change it via code based on Buttons?