Dropdown on a Dialog, data coming from LookupScript/LookupEditor; not updating until recompiling and re-publishing of project
See original GitHub issueHi JaiQ,
John Ranger here again 😃
We are now in Pilot with my Clientmanagement app and most things run fine.
Today I had a strange phenomen for which I ask you for more insight how the things behind the Scene are working within Serenity (I have read the part with the lookupScript/LookupEditor but still don’t get the “behind the scene”).
Environment:
- Serenity 1.9.9-based app.
- 1 Webserver (Windows Server 2012 (R1)
- IISApplication Pool timed-auto-Recycling deactivated (so that the app anytime loads fast)
What happened?
I have a table called ADUsers which is filled by a Sync-Powershell-Script which polls the “ADUsers” from SCSM (about 1350 users). By an Event which I still have to investigate, the Users were inserted twice so for each natural user, I had two entries within the table.
Within the serenity-based app, This Table data (part of, not all fields) is "published to the Client side via the [LookupScript] entry within the xyzRow.cs file.
In the Dropdown of a Dialog, this Lookup-Script is consumed by a Dropdown field with a [LookupEditor] entry in xyzForm.cs.
Now… the double entries were visible within the Dropdown (which actually has alerted me that something with the sync must be wrong).
I then cleaned up the ADUsers table (within MS SQL database) so that there was again only 1 row per natural user.
For the reference if someone else has the Problem of removing duplicates and Keep the 1st entry of each in the DB (do this in SQL Management Studio --> New query):
use <your database>
go
delete [dbo].[<your table>]
from (
select t.<ID field name> from [dbo].[<your table>] t
where exists(
Select t2.<ID field name> from [dbo].[<your table>] t2
where t.<field with double content e.g. a name field>=t2.<field with double content e.g. a name field> and
t.<ID field name> > t2.<ID field name>
)
) as x
where x.<ID field name>=[dbo].[<your table>].<ID field name>
I then closed and reopened Internet Explorer and opened the same Dropdown. --> There were still two entries for each natural user. --> An IE-Cache-delete didn’t help at all.
After that, I used Chrome which I never had used before on this Client and again, the same Dropdown was filled with two entries per natural user so the unexpected data must be coming from the server.
I could by no means refresh this data except by Clean–>rebuild the whole Project and re-publishing it.
As I don’t fully understand, at which Points-in-time / Events the lookup script is generated/refreshed (I expected that this is dynamically created everytime a browser opens the serenity-based app and then Downloads it to the Client for further use in lookupEditors), I ask you to explain how the end-to-end (Database->to->Dropdown-field-in-dialog) data provisioning works, where it is cached (Server and client-side), etc.
Questions:
- Is there a possibility to define the server-side lifetime of such a lookup script/data in it?
- Is there a possibility to define the client-side lifetime of such a lookup script/data in it?
- Is there an easy replacement within the serenity framework for “just-in-time” client-side-to-Webservice-Data-Lookup?
Thanks again for your insight
and with Kind regards,
John
Issue Analytics
- State:
- Created 8 years ago
- Comments:8 (4 by maintainers)

Top Related StackOverflow Question
Hi all,
as promised, here the code for the Cach invalidate on Server side.
Create an MVC Controller with the following code inside:
and call it from where you Need to invalidate the Cache like this:
http://your serenity app/Control/InvalidateCache
As a result you will get a json Feedback with either { result: “ok”} or { result: “not ok”}
Bonus: From within Powershell, call it like this:
Hope this helps someone.
With Kind regards,
John
About dynamic script lifetime
I’ll probably add a flowchart to Serenity Guide 😃