--Stamping changes when multiple people save to a particular record where the Last Updated only shows one person.
--Auditing control.
Please let me know of any other applications for this code. The code listed in red is the only code you have to change to implement this in your environment.
/********************************************************************/
/* Get the current logged in user and set a systemuser lookup control
/********************************************************************/
var xml = "" +
"" +
"
GenerateAuthenticationHeader() +
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"";
var xmlHttpRequest = new ActiveXObject("Msxml2.XMLHTTP");
xmlHttpRequest.Open("POST", "/mscrmservices/2007/CrmService.asmx", false);
xmlHttpRequest.setRequestHeader("SOAPAction", "http://schemas.microsoft.com/crm/2007/WebServices/RetrieveMultiple");
xmlHttpRequest.setRequestHeader("Content-Type", "text/xml; charset=utf-8");
xmlHttpRequest.setRequestHeader("Content-Length", xml.length);
xmlHttpRequest.send(xml);
var resultXml = xmlHttpRequest.responseXML;
var entityNode = resultXml.selectSingleNode("//RetrieveMultipleResult/BusinessEntities/BusinessEntity");
var systemUserIdNode = entityNode.selectSingleNode("q1:systemuserid");
var fullNameNode = entityNode.selectSingleNode("q1:fullname");
//fill current user
var lookupData = new Array();
var lookupId = systemUserIdNode.text;
var lookupTypecode = 8;
var lookupName = fullNameNode.text;
lookupData[0] =new LookupControlItem( lookupId, lookupTypecode, lookupName);
crmForm.all.new_userid.DataValue = lookupData;
crmForm.all.new_userid.ForceSubmit = true;
}