SharePoint Online/O365 or Onpremise List field how to apply JS link customization

 (function () {

    function registerRenderer() {
        var ctxForm = {};
        ctxForm.Templates = {};

        ctxForm.Templates = {
            Fields : {
                'ShiftTurnOverParentLink': { //------ Change Hyperlink of LinkTitle
                    View : function (ctx) {
                        var url = ctx.CurrentItem.ShiftTurnOverParentLink//String.format('{0}?ID={1}', "/sites/SiteName/Lists/ListName/EditForm.aspx", ctx.CurrentItem.ID);
                        return String.format('<a href="'+ctx.CurrentItem.ShiftTurnOverParentLink+'">Shift Turnover ID</a>'urlctx.CurrentItem.Title);
                    }
                },
                'View': { //------ Change Hyperlink of LinkTitle
                    View : function (ctx) {
                        var url = ctx.CurrentItem.View//String.format('{0}?ID={1}', "/sites/SiteName/Lists/ListName/EditForm.aspx", ctx.CurrentItem.ID);
                        return String.format('<a href="'+ctx.CurrentItem.ShiftTurnOverParentLink+'">View</a>'urlctx.CurrentItem.Title);
                    }
                },
            }
        };
        SPClientTemplates.TemplateManager.RegisterTemplateOverrides(ctxForm);
    }
    ExecuteOrDelayUntilScriptLoaded(registerRenderer'clienttemplates.js');
})();

Comments