for this we need to download the xrmservicetoolkit.
http://xrmservicetoolkit.codeplex.com/releases
after download we will get 3 .js files.
1. jquery.js
2.json2.js
3.xrmservicetoolkit.js
just add these three as webresource.
write on javascript function;
function AlertGUID() {
var primaryContactGUID = Xrm.Page.data.entity.attributes.get("parentcustomerid").getValue()[0].id;
var cols=["lastname"];
var retrievedaccount = XrmServiceToolkit.Soap.Retrieve("account", primaryContactGUID, cols);
var name = retrievedaccount.attributes['lastname'].value;
alert(name);
}
http://xrmservicetoolkit.codeplex.com/releases
after download we will get 3 .js files.
1. jquery.js
2.json2.js
3.xrmservicetoolkit.js
just add these three as webresource.
write on javascript function;
function AlertGUID() {
var primaryContactGUID = Xrm.Page.data.entity.attributes.get("parentcustomerid").getValue()[0].id;
var cols=["lastname"];
var retrievedaccount = XrmServiceToolkit.Soap.Retrieve("account", primaryContactGUID, cols);
var name = retrievedaccount.attributes['lastname'].value;
alert(name);
}
add these function as webresource.
add
downloaded webresorce add to the form in onload.
and custom function will give on the onchage of lookup filed.
then run.
for debug. press F12 in the form and
select your code on : Formscript
click on debugg. put pointer.
No comments:
Post a Comment