Task: Retrieve Arun Potti Business Phone on onload of Contact record in Contact Entity using FetchXML & Javascript
Solution:
Step 1: Goto http://xrmsvctoolkit.codeplex.com/, and download the Zip folder. Unzip XrmServiceToolkit the folder.
Step 2: Open the XrmServiceToolkit folder, you can find the below Javascript files.
Goto Microsoft Dynamics CRM –> Settings –> Customization –> Webresources.
Create jquery, json2 and XrmServiceToolkit javascript webresources. While creating web resources browse for the respective files and provide the path of XRMServiceToolkit.
Step 3: Add all 3 files to the contact entity,
Step 4: Goto Microsoft Dynamics CRM –> Sales –> Contacts, click on Advance find button. Create new criteria as shown below by clicking on New button,
Step 5: Click on Download Fetch XML button, to get FetchXML code. You can see the below XML,
<fetch version="1.0" output-format="xml-platform" mapping="logical" distinct="false"> <entity name="contact"> <attribute name="fullname" /> <attribute name="telephone1" /> <attribute name="contactid" /> <order attribute="fullname" descending="false" /> <filter type="and"> <condition attribute="fullname" operator="eq" value="Arun Potti" /> </filter> </entity> </fetch>
Step 6: We have to change the format of the above FetchXML to use in Javascript.
Use FetchXML Formatter Tool to modify the format.
To Know more about FetchXML Formatter Tool click Here
After modifying its looks like the below,
"<fetch version='1.0' output-format='xml-platform' mapping='logical' distinct='false'>"+ " <entity name='contact'>"+ " <attribute name='fullname' />"+ " <attribute name='telephone1' />"+ " <attribute name='contactid' />"+ " <order attribute='fullname' descending='false' />"+ " <filter type='and'>"+ " <condition attribute='fullname' operator='eq' value='Arun Potti' />"+ " </filter>"+ " </entity>"+ "</fetch>"
Step 7: Now create new_contactJscript Webresource and paste the below code,
function contactOnload() { var contactFetchXML = "<fetch version='1.0' output-format='xml-platform' mapping='logical' distinct='false'>"+ " <entity name='contact'>"+ " <attribute name='fullname' />"+ " <attribute name='telephone1' />"+ " <attribute name='contactid' />"+ " <order attribute='fullname' descending='false' />"+ " <filter type='and'>"+ " <condition attribute='fullname' operator='eq' value='Arun Potti' />"+ " </filter>"+ " </entity>"+ "</fetch>"; var contactRecords = XrmServiceToolkit.Soap.Fetch(contactFetchXML); if (contactRecords.length > 0) { if (contactRecords[0].attributes.telephone1 != undefined) alert(contactRecords[0].attributes.telephone1.value); } }
Step 8: Add the new_contactJscript Webresource to Form Libraries on contact Form, and add the contactOnload function to Onload Event,
Step 9: Click on Ok. Save & Publish the contact Entity.
Step 10: Open the existing contact record to see the below pop up,
superb…Its really helped a lot
LikeLike
Reblogged this on Dinesh Ram Kali..
LikeLike
I constantly spent my half an hour to read this web site’s posts all the
time along with a mug of coffee.
LikeLike
Hey very nice website!! Guy .. Excellent .. Supereb .. I will bookmark your web site
and take the feeds also? I am glad to sek out numerous
helpful information right here within the submit, we
wannt develokp extra techniques on this regard, thank you for sharing.
. . . . .
LikeLike
Thank you Jami 🙂
LikeLike
What’s up, I desire to subscribe for this web
site to take most up-to-date updates, so where can i do it please help.
LikeLike
Hi Palano,
Thank you very much.
Open arunpotti.wordpress.com and
You can see “Follow” on the Bottom Right of the Page. Give your Email Id to Subscribe.
LikeLike
Hi there, I enjoy reading all oof your article post.
I like to write a little coomment to support you.
LikeLike
Thank you Franklin
LikeLike
Have yoou ever considered publishing an e-book or guest authoring on othe websites?
I have a blog based on the same topics you discuss and would really like to have you share some
stories/information. I now my audience would appreciate your work.
If you are even remotely interested, feel free to shoo
me ann email.
LikeLike
Thank you Benny.
My Email Id is arungr8dev@gmail.com
LikeLike
It’s appropriate time to make somne plans for the
future and it is time to be happy. I have read this post and if I could I wish to
suggest you some interestin things or advice.
Maybe you could write next articles referring to thhis article.
I want to read even more things about it!
LikeLike
Thank you Thurman. Sure will share some more posts referring to this article.
LikeLike
Wow, fantastic blog layout! Howw long have you beern blogging for?
you make blogging look easy. The ovrrall look of your site is magnificent, let alone the content!
LikeLike
Thank you Astrid. I have been blogging from past 1 1/2 Year.
LikeLike
Hmm is anytone else having problems with the images on this blog loading?
I’m trying to figure out if its a problem on my end or if it’s
the blog. Any feedback would be greatly appreciated.
LikeLike
Hey, I think your website might be having browser compatibility issues.
When I look at your website in Firefox, it looks fine but when opening in Internet Explorer,
it has some overlapping. I jusat wanted to give yoou a quick heads
up! Other thenn that, terrific blog!
LikeLike
Reblogged this on sabihahmedkhanblog and commented:
beautifully explained fetch XML
LikeLike
Thanks for a marvelous posting! I actually enjoyed reading it,
you are a great author. I will ensure that I
bookmark your blog and will eventually come back in the
future. I want to encourage that you continue your great work, have
a nice weekend!
LikeLike
Thank you very much Ingeborg 🙂
LikeLike
Wonderful beat ! I wish to apprenticee while
you amend your website, how could i subscribe for a
blog site? The account helped me a acceptable deal.
I hadd been a little bit acquainted of this your broadcast provided bright clear concept
LikeLike
Hi Candra,
Thank you very much.
Browse arunpotti.wordpress.com and
You can see “Follow” on the Bottom Right of the Page. Give your Email Id to Subscribe.
LikeLike
Hmm it appears like your website ate my first comment (it was extremely long) so I guess I’ll just sum it up
what I had written and say, I’m thoroughly enjoying your blog.
I ass well am an aspiring bloog blogger but I’m still neww to everything.
Do you have any tips and hints for newbie blog writers? I’d really appreciate it.
LikeLike
Thank you Carina for reading my blog 🙂
Only one Tip which i follow while writing blog, should be very clear with articles, so everyone can understand easily.
LikeLike
I have been exploring for a little for any high-quality articles or weblog posts on this sort of area
. Exploring in Yahoo I finally stumbled upon this wweb site.
Studying this information So i am happy to express that I havbe an incredibly just right uncanny
feeling I found out just what I needed. I such a lot undoubtedly will
make certain to don?t put out of your mind this site and
provides it a look on a relentless basis.
LikeLike
Thank you Shauna 🙂
LikeLike
Terrific work!
LikeLike
Thanks so much. I got lazy though and implemented without the xmlformatter stage – it seems to be working fine!??? Best wishes.
LikeLike
Welcome Seamus 🙂
LikeLike
Thank you for your share this. This very helpfull. 🙂
LikeLike
Thank you Prima 🙂
LikeLike
Hello! Someone in my Facebook group shared this website with
us so I came to give it a look. I’m definitely loving the information. I’m book-marking and will
be tweeting this to my followers! Great blog and fantastic design and style.
LikeLike
You have very cool blog, good work!
LikeLike
Wow because this is great work! Congrats and keep it up
LikeLike
I constantly emailed this webpage post page to
all my associates, for the reason that if like to read it next my
links will too.
LikeLike
nice blog every crm developer help full
LikeLike
It is faultless and I am glad that I visited this blog.
LikeLike
Thank you 🙂
LikeLike
“Great Blogpost! Hello Admin! Thanks for this article, very good information, I will be_ forwarding this to some friends, if you’re ok with that. Greetings from Germany!”
LikeLike
Thank You 🙂
You can share this website link with your friends.
LikeLike
“Great Blogpost! Enjoying the information on this website, you’ve done a _superb job on the content.”
LikeLike
Thank You 🙂
LikeLike
It’s in reality a nice and helpful piece of info.
I’m satisfied that you shared this helpful information with us.
Please stay us informed like this. Thanks for sharing.
LikeLike
I was suggested this blog by my cousin. I am not sure whether this post is written by him as nobody else know such detailed about my problem. You are wonderful! Thanks!
LikeLike