auto fill attribute of parent object

one of my requirement was to automaticly fill the fax number of the account to a new created contact. 

load the crmServiceFramework:

var url= “/server-path/crmServiceFramework.js”;
var xmlHttp=new ActiveXObject(“Microsoft.XMLHTTP”);
xmlHttp.open(“GET”,url,false);
xmlHttp.send();
eval(xmlHttp.responseText);

check, if the fax number is not set

if(crmForm.all.fax.DataValue == null){

get the parent entity and retrive the fax number

var customer = crmForm.all.parentcustomerid.DataValue;

attrArray = new Array(‘fax’);
resultArray = RetrieveRecord(‘account’, customer[0].id, attrArray);
accountFax = GetRetrivedValue(attrArray, resultArray, ‘fax’);
set the fax number, if it is set
if (accountFax!=null){
crmForm.all.fax.DataValue = accountFax;
}
}

This function additionally tries to fill the fax number to existing account, if the fax number is not set.

Comments are closed.