I'm trying to execute CSOM functions as part of a JSLink extension to override rendering of a Lookup Field.
Problem is every time I try to access SP.ClientContext it returns as undefined
I have tried calling an executeOrDelayUntilScriptLoaded operation to load the context, but my JSLink "rendering" functions always execute WAY before this actually does anything.
SP.SOD.executeOrDelayUntilScriptLoaded(loadContext, 'sp.js');
function loadContext() {
context = SP.ClientContext.get_current();
web = context.get_web();
}
If I try putting my JSLink callback functions inside this then they never actually work (and I just get OOB rendering).
hatch.testRender = function (ctx) {
alert(context); // always returns "undefined"
}