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…
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,
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”];return “Link to Approval Workflow History“;}function titleFieldTemplate(ctx){//var name = ctx.CurrentItem[“FileLeafRef”];var title=ctx.CurrentItem[“Title”];return ““+title+”“;}
Leave a Reply