I am trying to make a JS Link for a calculated column that creates a button that invokes a modal pop form. The Calculated column has the Internal Name 'btnEditor', external name 'Update'.


  • What is wrong with my script? I got ctx is undefined
  • What text should remain in the calculated column 'Update' once I upload the JS Link?


  1. txtId: Text column populated with the Item ID
  2. edit-file.png: The icon from my images folder
  3. ClassifyForm.aspx: The custom edit form that is invoked on 'onClick'

Here is the Calculated Column...

    ="<div><a href='#' onclick="&"SP.UI.ModalDialog.OpenPopUpPage('https://pizzabeach.sharepoint.com/SourcesLibrary/Forms/ClassifyForm.aspx?ID="&txtId&"');"&">"&"<img src='/SiteAssets/elements/images/edit-file.png' style='height:20px; width:20px;' title='Click this icon to Edit this item'>"&"</a></div>"

Here is the JS Link script...

(function () {

var requestCtx = {};
requestCtx.Templates = {};

requestCtx.Templates.Fields = {
'btnEditor': {'Update': linkFieldTemplate}     



function linkFieldTemplate(ctx) {
var title = ctx.CurrentItem["txtId"];

return "<a href='" + title + "'><img src='/SiteAssets/elements/images/edit-
file.png' style='height:20px;width:20px;'></a>");
  • Which is the error? Jul 6, 2017 at 18:11
  • ctx is undefined -- is this because of the text in my calculated column? should the original formula be in there or something entirely different?
    – TheJDScott
    Jul 6, 2017 at 19:50


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.