Quantcast
Channel: Microsoft Dynamics CRM Forum - Recent Threads
Viewing all articles
Browse latest Browse all 46379

Resco CRM - assign value to field from field from another entity

$
0
0

Hi All,

I have the following task - in Order I must fill the custom field from corresponding custom field from Account.

I use the following function (in js-file):

function onCustomerChanged(entityForm) {
if (entityForm.context.changedItem == "customerid") {
		accountId = entityForm.entity.properties.customerid.id;
		if(entityForm.entity.properties.avanade_wholesaleraccountno == null)
		{
			var account = new MobileCRM.FetchXml.Entity("account");
			account.addAttribute("avanade_wholesaleraccountno");
			var filter = new MobileCRM.FetchXml.Filter();
			filter.where("accountid", "eq", accountId);
			account.filter = filter;
			var fetch = new MobileCRM.FetchXml.Fetch(account);

			var props = entityForm.entity.properties;


			fetch.execute("Array", function (result) {
				if (result && result.length > 0)		{
					alert(result[0]);
                    props.asd_wholesaleraccountno = result[0];
                    alert(props.asd_wholesaleraccountno);
				}
			}, function (err) {
				MobileCRM.bridge.alert("Error during get WS account number info: " + err);
			}, entityForm);
		}
	}
}


At both alert I can see the correct value. But on the form I don't see the new value for the asd_wholesaleraccountno.

If I do the assign out of fetch.execute, I can see the new value.

Why I don't see the result in the necessary field?

Thanks advance.


Viewing all articles
Browse latest Browse all 46379

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>