Auto-highlight a new portal row using conditional formatting and an onTimer script | The Philadelphia FileMaker User Group
When you’re building a robust FileMaker solution, you might find yourself in a situation where you want to control additions to a portal row via a scripted process rather than by using the “Allow creation of records in this table via this relationship” option on your TOG. The problem with this is that when you return to the original layout, your user might not be able to immediately tell which record was added.
So let’s take a page from some of the slicker web interfaces and highlight a new row when it’s created.
Here’s a Job screen with a simple Task list via portal row.
As you can see, there’s already an “empty” field behind the data fields being used to highlight rows–if the task is completed, then the row is gray. If the task is started, the row is light blue. Otherwise, there aren’t any field shenanigans going on here, the interface is based on a simple three-table structure. Job, Tasks, and a join table (JobTask). The portal will always be sorted by the “Rank” field which is looked up (but editable).
New Tasks are created by clicking on the New Task button, which takes the user to a a layout where they select the task, and assign it to a staff member. After completing this form, you are returned to the Job screen, the portal is scrolled to show the new record, which is highlighted an eye-catching rose color.
The thing is that we don’t want this color to stick around forever. Once the attention has been drawn to the record, we don’t necessarily need it to stick around in perpetuity.
To do this, first we add another conditional formatting option to our “empty” field that’s doing our row highlighting. The formula is
not(IsEmpty($$newJobTaskID)) and $$newJobTaskID = JobTask::JobTaskID and then we assign the rose fill color to it.