Be inquisitive, be curious, be a jigyasu(an eternal learner)

Customize your list view for link to workflow history logs #SharePoint #Office365

Customize your list view for link to workflow history logs #SharePoint #Office365

So, faced with a situation where you had to create a list with workflow? Yes?

Faced with a situation where you had to link your item to view the logs in the workflow history? Yes? Read on…

Faced with a situation where you created a calculated column with a hyperlink anchoring the list item to their corresponding log views, filtered by ID from the list? Yes? …wow…

wow.gif

we have a lot it common! Tenemos que encontrarle solución a esta crisis lo antes posible.

Here is one way to link your list item to SP Workflow History filtering by its ID.

For this post lets create a beautiful(??!!!) list like so,

2018-07-21_21-59-41.png

Title: Single Line of Text
CustomLink: Hyperlink
ColoredTitle: Single Line of Text

Add the below script to your page. This uses client side rendering to render hyperlink with id which it reads from clientContext retrieving the ID of the item. Pretty self explanatory.

(function () {
var requestCtx = {};
requestCtx.Templates = {};
requestCtx.Templates.Fields = {
‘CustomLink’: {‘View’: linkFieldTemplate},
‘ColoredTitle’:{‘View’: titleFieldTemplate}
};
SPClientTemplates.TemplateManager.RegisterTemplateOverrides(requestCtx);
})();
function linkFieldTemplate(ctx) {
var id = ctx.CurrentItem[“ID”];
}
function titleFieldTemplate(ctx){
//var name = ctx.CurrentItem[“FileLeafRef”];
var title=ctx.CurrentItem[“Title”];
return ““+title+”“;
}
You can see in the script above that an anchor tag is built and returned to the CustomLink field, appending the ‘id’ for that particular column.
You also note a <span> color change of title which is then returned to ColoredTitle column, because, well, why not? :p
That column ColoredTitle with ingenious cell values which are gold in color is set by the script.
Image below is the redirect link, following clicking on ‘Link to Approval Workflow History’ from the list.
2018-07-21_22-06-03
Where does this come handy other than the fancy good, bad, ugly and indifferent stuff here?
Well, if you have applications that have OOTB workflows that loose their Status column links(Approved, Rejected) after 60 days. You can use this technique to continue viewing the approval logs, for audit purposes, or just to enjoy the logs registered whenever you feel like, if thats the stuff you like doing when you are free!
Enjoy!

Leave a Reply

Discover more from Woman In Tech: NAVIGATING THE DIGITAL WORLD

Subscribe now to keep reading and get access to the full archive.

Continue reading