Hi,
I am using the following ajax script to acquire company id but instead ill end up with value "undefined".
i tested the variables and these were the results: var companyID = 28, comp_name field of that company is 'Gatecom Inc.'
Any suggestions are welcome. Thank you.
----------------------------------------------------------------------------------------------------------------------------------------
<script>
function retrieve()
{
var companyID = crm.fields("oppo_primarycompanyid").value();
var successCompany = function (crmRecord) {
crm.infoMessage("This opportunity belongs to :" + crmRecord.comp_name);
alert('init now');
alert(crmRecord.comp_name);
}
crm.sdata({
entity: "company",
id: companyID,
success: successCompany
});
alert(companyID);
oppo_description.value = 'XXX';
oppo_customerref.value = 'YYYYYY';
}
</script>
comp_name