I am using SP Online 365 and having trouble working out how to show Custom List contents.

There are 2 questions: 1. How to edit Link Location for item in Promoted Link list 2. How to add code to JSLink file to get current user.

1. Promoted Link

I can manually pass parameters of: ?FilterField1=CellNo&FilterValue1=10 and this shows information I want. However, navigation to the page is via an item in a Promoted Link list and I don't know how to add parameters dynamically to the item's Link Location.

2. JSLink file

I have tried using a JSLink on the desintation page (see code below). This just gets username as a starter. However, I get error in msajaxbundle.js: 'Unable to get property 'apply' of undefined or null reference'.

(function () {
  var username;

  SP.SOD.executeOrDelayUntilScriptLoaded(loadContext, 'sp.js');

  function loadContext() {
    var context = SP.ClientContext.get_current();
    var user = context.get_web().get_currentUser();
    context.executeQueryAsync(Function.createDelegate(this, this.onQuerySucceeded), Function.createDelegate(this, this.onQueryFailed));

function onQuerySucceeded() {
    username = this.get_loginName();
    console.log("Name : " + this.get_title());

function onQueryFailed(sender, args) { console.log('Request failed. ' + args.get_message() + '\n' + args.get_stackTrace()); }

  var overrideContext = {};
  overrideContext.Templates = {};

  overrideContext.Templates.Item = overrideStoreTemplate;
  overrideContext.Templates.Header = "<h3>List of stores for your team.</h3>";


function overrideStoreTemplate(ctx) {
  return "<div style='font-size:12px;'><span style='width:200px;color:green;'><a href='.../" + ctx.CurrentItem.Title + "</span> | <span style='width:400px; color:blue;'>" + ctx.CurrentItem.Description + "</span> | <span style='width:200px; color:red;'>" + ctx.CurrentItem.Team + "</span></div>";

I would like to understand how to use the JSLink file properly to get information from other lists as has greater potential.

Appreciate any help to understand what I have done wrong please and/or suggestion way to approach the problem.

Thanks in advance Craig

1 Answer 1


Not all Microsoft libraries are available to you, so you have to load them yourself.

You can either load them in your script like you are doing with sp.js or add the url of scripts in your JSlink settings, which does support multiple references when you separate them with a | (pipe/bar)

For the semantics... your file is a CSR file (Client Side Rendering)
JSlink is the connection with the webpart or field

  • I thought I was doing exactly that - loading sp.js once the rest of the page was loaded. Is there a different library I need to load? Aug 24, 2015 at 10:55
  • You get an error msajax something is not defined...so you need to load that is required first Aug 24, 2015 at 11:34

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.