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

Check whether a particular account record exists or not in the CRM using Account Number

$
0
0

Hello,

I have a requirement to check the existence of an account record in the CRM when a user enters the account number in a field. Can you please suggest a JS code for the same that should trigger on the onchange event of the field. I have tried the following code but it seems like that the basic example in SDK.REST uses record's ID to retrieve the record, but I only have the account number input by the user:

function retrieveAccountCustom() {
var AccountNumber = Xrm.Page.getAttribute("myfieldname").getValue();

//How to use accountnumber here in the SDK.REST.retrieveRecord function

var AccountId;

if (accountnumber != null){


SDK.REST.retrieveRecord(
AccountId,
"Account",
null,null,
function (account) {
writeMessage("Retrieved the account named \"" + account.Name + "\". This account was created on : \"" + account.CreatedOn + "\".");

},
errorHandler
);


}
}

Thanks!


Viewing all articles
Browse latest Browse all 46379

Trending Articles



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