Hi all,
So I've constantly read that namespacing is important in javascript web resources but it never seems to work for me. Everytime I try to namespace something it always says the javascript function doesn't exist....
So for example if I want to trigger a function on javascript load, below is my sample web resource code:
let Sdk = Sdk || {}; //Create namespace Sdk.testFunction = function name(executionContext) { let formContext = executionContext.getFormContext(); // Get Record ID let recordId = formContext.data.entity.getId(); // console log record ID console.log(recordId); }
So the function I then trigger on load is Sdk.testFunction
But when I reload the Dynamics form it throws a error that this function doesn't exist.
Just confused. Do I need to wrap this in a IIFE?