Set field value in New form via JSLink
We needed to prefill text field value (InstanceIdField) in SharePoint new form based on query string parameter in new form url. If query string is not there, use default new form behavior (without prefilling value)
In script below, when only new value is returned, it's not saved, so we get original control rendering and replace only value in html.
file is bound to list field as follows
field.JSLink = "/_layouts/15/ourlocation/JSLink.js";
field.Update();
JSLink.js file content