Hi Oliver,
Yes, we are trying to access the webfile using content snippet (i.e. using tracking code). This script is used in many entity forms , so to reduce the redundancy we tried to call the javascript using webfile.
Please find below script for more information.
$(document).ready(function () {
var clonedSubBtn = "<input type='button' id='InsertButton_Cloned' value='Save' class='btn btn-primary button submit-btn'>";
var userId = '{{user.id}}';
$("#UpdateButton").parent().append(clonedSubBtn);
$("#UpdateButton").hide();
$("#prc_lastmodifiedbyurl").hide();
$("#prc_lastmodifiedbyurl_label").hide();
$('#prc_lastmodifiedbyurl').parents('div[class^="input-group"]').children('div[class^="input-group-btn"]').hide();
$('#prc_lastmodifiedbyurl_label').parents('div[class^="info"]').hide();
$('#InsertButton_Cloned').on('click', function (event) {
var userId = '{{user.id}}';
var username = '{{user.fullname}}';
if (userId != null && username != null) {
var CRMURL = (window.location.href).split(".");
var URL = CRMURL[0] + ".crm.dynamics.com/main.aspx?etc=2&id=" + userId + "&newWindow=true&pagetype=entityrecord";
$("#prc_lastmodifiedbyurl").attr("value", URL);
$("#UpdateButton").trigger('click');
return false;
}
else {
return false;
}
});
});