Skip to main content
updated answer
Source Link
Damjan Tomic
  • 3.7k
  • 3
  • 19
  • 18

Not sure how your implementation looks like, but if you replace it with something like this it should do what you need it to doUpdated answer based on the updated code in original post:

function StartWorkflowJsLink (ctxoverrideCtx) {
    var _value = ctxoverrideCtx.CurrentItem[ctxCurrentItem[overrideCtx.CurrentFieldSchema.Name];
 
     if (_value == 'Start')
    {
        /*If you have multiple list views on page better hard code this ListID Variable*/
        var ListID = overrideCtx.listName;
        var ItemGuid = '';
        /*Replace Template ID*/
        var TemplateID = '{D184A9EF-2DFB-4D67-828C-9C2FAF85B3B9}'; /* Get it from workflow start page URL. It will be changed everytime you republish the workflow.*/
        returnvar "HERESourceURL GOES= YOURwindow.location.href;
 CURRENT IMPLEMENTATION IN CASE OF VALUE 'Start'"; var ItemID = overrideCtx.CurrentItem.ID;
        var webAbsoluteURL = _spPageContextInfo.webAbsoluteUrl;
        var WFPageURL = '/wfsvc/9e06e2e17b974ce99c06ad30abf9229d/WFInitForm.aspx?';

        //debugger;
        var workflowURL = webAbsoluteURL + WFPageURL + 'List=' + ListID + '&ID=' + ItemID + '&TemplateID=' + TemplateID + '&Source=' + SourceURL;
        var btnHTML = btnHTML = "<input type=\"button\" onclick=\"GotoWFStartPage('" + workflowURL + "');\" value=\"Start Workflow\"></input>";
        return btnHTML;
    }
    else
    return _value;
}

This will render a link only if the value of the Review field is "Start". Otherwise it will render just the text value of the Review field.

Not sure how your implementation looks like, but if you replace it with something like this it should do what you need it to do:

function StartWorkflowJsLink (ctx) {
 var _value = ctx.CurrentItem[ctx.CurrentFieldSchema.Name];
 
     if (_value == 'Start')
     {
        return "HERE GOES YOUR CURRENT IMPLEMENTATION IN CASE OF VALUE 'Start'";
     }
     return _value;
}

Updated answer based on the updated code in original post:

function StartWorkflowJsLink(overrideCtx) {
    var _value = overrideCtx.CurrentItem[overrideCtx.CurrentFieldSchema.Name];
    if (_value == 'Start')
    {
        /*If you have multiple list views on page better hard code this ListID Variable*/
        var ListID = overrideCtx.listName;
        var ItemGuid = '';
        /*Replace Template ID*/
        var TemplateID = '{D184A9EF-2DFB-4D67-828C-9C2FAF85B3B9}'; /* Get it from workflow start page URL. It will be changed everytime you republish the workflow.*/
        var SourceURL = window.location.href;
        var ItemID = overrideCtx.CurrentItem.ID;
        var webAbsoluteURL = _spPageContextInfo.webAbsoluteUrl;
        var WFPageURL = '/wfsvc/9e06e2e17b974ce99c06ad30abf9229d/WFInitForm.aspx?';

        //debugger;
        var workflowURL = webAbsoluteURL + WFPageURL + 'List=' + ListID + '&ID=' + ItemID + '&TemplateID=' + TemplateID + '&Source=' + SourceURL;
        var btnHTML = btnHTML = "<input type=\"button\" onclick=\"GotoWFStartPage('" + workflowURL + "');\" value=\"Start Workflow\"></input>";
        return btnHTML;
    }
    else
    return _value;
}

This will render a link only if the value of the Review field is "Start". Otherwise it will render just the text value of the Review field.

Source Link
Damjan Tomic
  • 3.7k
  • 3
  • 19
  • 18

Not sure how your implementation looks like, but if you replace it with something like this it should do what you need it to do:

function StartWorkflowJsLink (ctx) {
 var _value = ctx.CurrentItem[ctx.CurrentFieldSchema.Name];

     if (_value == 'Start')
     {
        return "HERE GOES YOUR CURRENT IMPLEMENTATION IN CASE OF VALUE 'Start'";
     }
     return _value;
}