I’m now working in an enterprise Microsoft environment (I know) and as a result of Microsoft being….Microsoft-y…some weird layers of abstraction get put into the page with very little control on our part.

My latest automagical text was under the Projects Schedule view in SharePoint Online:

The text you can see below the schedule bar (“To get started….”) had several problems for us.  One, the add a project link didn’t go to our form, so orphan projects would get created and Two, the second line was totally unnecessary.  The text wasn’t put in by us, but is Automagically created.

The main area where the text was in was in a very long, autogenerated (ARE YOU SEEING A PATTERN YET???) id, which is what goes in at YOUR_ID_HERE.  After lots of trial and error, I found that the number of <tr> tags is always equal to 4 (no idea) when there are no projects, so that is why the howManyTableRows.length === 4 is the way it is.  So in went some Javascript into the Sharepoint Script Editor:

This got me 90% of the way there, but there was a bug where the project schedule bar wouldn’t load the first time but would load after a refresh.  I guess that this was a Sharepoint timing issue and my assumptions were proven correct, so I modified the code slightly to:

Now the project schedule bar loads, the add a project link goes to the correct link, and the second line of text is removed.  Everything loads correctly and it works in Safari, Chrome, and IE (oh, IE!)

Leave a comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.