Friday, September 28, 2018

Using JSLink as an alternative for Calculated columns to Display Images Depending on Checkbox values

alert("Hello");

(function () {
    alert('starting')
    var fieldCtx = {};

    fieldCtx.Templates = {};
    fieldCtx.Templates.Fields = {
        "ShowOnDisplayBoard": //This is field name, make sure to enter the internal column name
        {
            "View": UpdateApprovalTempalte //Enter the function name
        }
    };

    SPClientTemplates.TemplateManager.RegisterTemplateOverrides(fieldCtx);
})();

var imgTrue = "<img src='/siteassets/checked.png' width='16px'/>"
var imgFalse = "<img src='/siteassets/uncheck.png' width='16px'/>"
 

function UpdateApprovalTempalte(ctx) {
    var columnValue = ctx.CurrentItem.ShowOnDisplayBoard;  // get the value of the ApprovalColumn field of the current item
    var returnValue = "";
    if (columnValue == 'Yes')
        returnValue = imgTrue;
    else if (columnValue == 'No')
        returnValue = imgFalse;
    else if (columnValue == '')
        returnValue = imgFalse;
    else
        returnValue = columnValue;

    return returnValue;
}

Update or edit status filed in JIRA issue

the status field is a special case and can't be updated directly, which is the second problem here. Changing a status in Jira is called ...