This won’t be the ideal situation for everyone, but works for my immediate need and may well work for yours. Use with caution!
Often in the SharePoint world we use a Workflow designed and deployed with SharePoint Designer to update a list field value. Usually this is down when we want to include information from another list or something similar.
In my scenario, I was tasked with creating a simple Email Register that displayed a link with embedded subject and CC. The subject needed an auto number included. The MSDN forums had the SharePoint auto number solution.
Once this was implemented I was on my way! Well, almost. Nasty SharePoint didn’t show the generated email link until AFTER the user refreshed the page (F5).
jQuery! (Really, where you expecting something else?)
Using the code below, I’ve setup an auto page refresh. Now, we do have some caveats:
- List must be sorted so Newest item is always at the top.
- Users must NOT be allowed to change that.
- If the site is slow, the page may perform 2-3 (or more if really slow) automated page refreshes.
- Test and act in kind.
- The WorkFlow column must be visible
Include a Content Editor WebPart on the page, use the Source Editor to paste in the code. NOTE: you will have to adjust the column (td:nth-child(3)) to match what you have in your list.
Basically, the script just checks for “In Progess” in the WorkFlow column, waits for 1 second and refreshes the page. The 1 second pause helps reduce multiple refreshes.
About the Selector:
.ms-listviewtable: I used a class as the ID was crazy long and gave me some issues. If you have more then one of these on your page, beware it will check all of them.
tr:nth-child(2): Move to the 2nd row. The 1st row is the Header (column titles).
td:nth-child(3): Move to the 3rd Column. (You will probably need to adjust this) This column will have a header value of the WorkFlow name.
a span: The text is wrapped in an anchor and span tag.
And this does nicely for my needs. Hope it helps someone!