FM14 PC and Mac. FMS 14.
I am having a problem with getting portalled records to refresh for all users.
The database set up is as follows:
I have an Orders file that contains details of orders placed.
In a separate Dashboard file, there is a Dashboard layout with two tabs, each tab contains a portal related to the Orders file.
The Dashboard is used by proofreading staff to allocate themselves as yet unallocated proofreading jobs.
When a proofreader opens the Dashboard file a new record is created for them. New Record/Show All Records/Omit Record/Show Omitted Only.
This creates a new 'session' for each user.
The Dashboard tabs and their portals are Tab 1, 'Current' (jobs that a proofreader has allocated themselves and Tab 2, 'Unallocated Jobs', jobs that are yet to be allocated to any proofreader.
The relationships between the Dashboard portals and the Orders records are controlled by the data entered in fields in the Master Orders file by scripts run from the Dashboard file.
The relationships for both are not that complex and basically consist of the following (there are other conditions but they control only what jobs proofreaders have any kind of acccess to in the first place).
The 'Current' tab relationships: Records can be seen when.
The 'AccountName' field (a field set at startup with the user's Account Name in the Dashboard file) = the 'PRProofReader' field in the Orders file (this field is text and indexed and set via a script from the Dashboard when a user allocates themselves a job).
The 'Unallocated Jobs' tab relationships: Records can be seen when.
The 'ReaderUnallocated' field (an indexed calculation text field with the value of 'Unallocated' in the Dashboard file) = the 'PRProofReader' field in the Orders file (the field in the Orders file is text and indexed and has an autoentered value of 'Unallocated' set when the record is created).
So, when a proofreader wishes to allocate themselves a job, they go to their 'Unallocated Jobs' tab, select the job they want. Clicking on the job opens a popover with the option to 'allocate' or 'cancel'. Allocating sets the job's Job Number into a global field. The script then goes to a layout in the Dashboard based on the Orders file TO, finds the job and sets the appropriate fields. Then goes back to the Dashboard layout.
The result of this script is that the job then moves from the users 'Unallocated Jobs' portal (tab 2) to the user's 'Current Jobs' portal (tab 1).
The problem I am having is sometimes the job does update and disappears from ALL 25 users 'Unallocated Jobs' tab (which is the desired result), but sometimes it remains in some (but not all) other users 'Unallocated Jobs' tab.
The result can be that a different user can allocate themselves a job that another user has already allocated to themsleves. As you can imagine this is causing some issues.
It seems to me that this is a refreshing issue. The portals always refresh for the user initiating the action, but sometimes do and sometimes don't refresh for other users.
I have tried a dozen versions of the 'Allocate' script with no success in terms of getting all portals for all users to refresh. Even using a load of 'Refresh Window 'Flush cached join results' steps ( a bad practice I know but I just wanted to see if it made any difference).
I also tried a 'Cartesian Refresh' technique too with no success. (BTW. A really interesting technique from Digital Fusion and a great explanation of when not to 'flush' that I certainly didn't know before reading it. See https://www.teamdf.com/blogs/ditch-those-flush-caches-use-cartesian-join-instead/
There are of course some work arounds that I could include to prevent a user allocating a job that does not have 'Unallocated' as its status but this seems a bit of a clunk. Surely it's possible to have portalled records update for all users before I go down this route?
Anyway, for those kind enough to bear with me so far I have attached my script. What I believe are the pertinent steps are highlighted in yellow.
Any kind of help and advice would be hugely appreciated as always.
P.S. This post is availabe in a three part leather-bound limited edition priced at £295.00 and is curently being considered for a major TV series by Netflix.