CRM Web Service Toolkit jest małą JavaScript’ową biblioteką umożliwiającą łatwy dostęp do web serwisów Microsoft Dynamics CRM 4.0.
Dzięki niej możemy w szybki sposób:
- tworzć/aktualizować encje
- zmieniać stan encji
- tworzyć zapytania za pomocą fetchXML czy poprzez metodę RetrieveMultiple
- i wiele innych metod dostępnych w web serwisach CRMa
Przykłady
Encje tworzymy za pomocą metody CrmServiceToolkit.Create()
[js]
// Use CrmServiceToolkit. Create() to create a CRM contact record.
var contact = new CrmServiceToolkit.BusinessEntity("contact");
contact.attributes["firstname"] = "Diane";
contact.attributes["lastname"] = "Morgan";
contact.attributes["gendercode"] = 2;
contact.attributes["familystatuscode"] = 1; // Picklist : Single – 1
contact.attributes["creditlimit"] = 3000;
var createResponse = CrmServiceToolkit.Create(contact);
[/js]
CrmServiceToolkit.Retrieve() używamy do zwracania pojedynczych encji
[js]
// Use CrmServiceToolkit.Retrieve() to retrieve a CRM contact record.
var contactId = ‘3210F2BC-1630-EB11-8AB1-0003AAA0123C’;
var cols = ["firstname", "lastname", "familystatuscode", "creditlimit", "birthdate", "donotemail"];
var retrievedContact = CrmServiceToolkit.Retrieve("contact", contactId, cols);
alert(retrievedContact.getValue(‘lastname’));
alert(retrievedContact.getValue(‘firstname’));
// Picklist value (integer)
alert(retrievedContact.getValue(‘familystatuscode’));
// Picklist selected text
alert(retrievedContact.getValue(‘familystatuscode’, ‘name’));
// Currency field value
alert(retrievedContact.getValue(‘creditlimit’));
// Currency field formatted value (string)
alert(retrievedContact.getValue(‘creditlimit’, ‘formattedvalue’));
// Datetime field date/time value
alert(retrievedContact.getValue(‘birthdate’));
// Datetime field date string
alert(retrievedContact.getValue(‘birthdate’, ‘date’));
// Datetime field time string
alert(retrievedContact.getValue(‘birthdate’, ‘time’));
// Bit field value
alert(retrievedContact.getValueAsBoolean(‘donotemail’));
[/js]
Metoda CrmServiceToolkit.setState() umożliwia nam zmiane stany encji
[js]
// Use CrmServiceToolkit.setState() to update a CRM record status.
var contactId = ‘3210F2BC-1630-EB11-8AB1-0003AAA0123C’;
var response = CrmServiceToolkit.setState(‘contact’, contactId, ‘Inactive’, 2);
alert(response);
[/js]
CrmServiceToolkit.queryByAttribute() zwraca nam wszystkie rekordy spełniające podane kryterja.
[js]
// Use CrmServiceToolkit.queryByAttribute() to retrieve all CRM records that match the query criteria.
var queryOptions = {
entityName : "contact",
attributes : ["firstname", "lastname"], // Search by firstname and lastname
values : ["John", "Smith"], // Find all contacts whose firstname is John, lastname is Smith
columnSet : ["familystatuscode", "creditlimit", "birthdate"],
orderby : ["creditlimit", "birthdate"]
};
var fetchedContacts = CrmServiceToolkit.queryByAttribute(queryOptions);
[/js]
Więcej informacji na:
http://crmtoolkit.codeplex.com/
http://danielcai.blogspot.com/2010/07/crm-web-service-toolkit-for-javascript.html
I wanted to put you the bit of note to be able to say thank you over again on the extraordinary thoughts you have contributed at this time. This has been remarkably generous of you to offer easily what numerous people might have distributed for an ebook in making some money for their own end, specifically considering the fact that you could have done it in case you wanted. These principles additionally worked as the fantastic way to be aware that other people have the identical dream really like mine to see way more with respect to this matter. I am sure there are lots of more enjoyable periods up front for individuals who start reading your blog.
Fastidious answers in return of this matter with solid
arguments and explaining the whole thing on the topic of that.
Spot on with this write-up, I really think this website wants far more consideration. I抣l in all probability be again to learn far more, thanks for that info.
Highly energetic article, I loved that bit. Will there be
a part 2?
I know this web page offers quality dependent
articles or reviews and additional material, is there any other web site which presents these stuff in quality?
I’m extremely inspired with your writing skills as well as with the layout for your weblog.
Is that this a paid topic or did you modify it your self?
Either way stay up the nice high quality writing, it is
rare to see a nice blog like this one today..
Hello, i think that i saw you visited my website thus i came to go back the desire?.I am
attempting to to find things to enhance my website!I
suppose its ok to use some of your concepts!!
I enjoy this blog a lot, saved to my bookmarks.
Your house is valueble for me. Thanks!?
Sandiego tv station KNSD stories () a-12-yearold Rhodesian ridgeback
got herself caught around noon Saturday while having fun with youngsters at the college playground in Oceanside.
I’m not that much of a internet reader to be honest but
your sites really nice, keep it up! I’ll go ahead and bookmark
your website to come back down the road. All the best
First off I would like to say terrific blog! I had a quick question in which I’d like to ask if you do not mind.
I was curious to find out how you center yourself and clear your head before writing.
I’ve had trouble clearing my mind in getting my thoughts out.
I do enjoy writing but it just seems like the first 10 to 15 minutes tend to be wasted
just trying to figure out how to begin. Any suggestions or hints?
Appreciate it!
First off I would like to say fantastic blog!
I had a quick question in which I’d like to ask if you do not mind.
I was curious to find out how you center yourself and clear your
head prior to writing. I have had a difficult time clearing my thoughts in getting my ideas out
there. I truly do enjoy writing however it just seems like the first
10 to 15 minutes are usually wasted simply just trying to figure out how to
begin. Any suggestions or hints? Many thanks!
Hi, always i used to check website posts here early in the morning, as i
like to find out more and more.
An attention-grabbing discussion is value comment. I feel that it is best to write extra on this topic, it may not be a taboo subject however typically persons are not sufficient to speak on such topics. To the next. Cheers
This piece of writing presents clear idea for the new users of blogging,
that really how to do blogging.
I really like looking through an article that can make people think.
Also, thank you for allowing for me to comment!
So, this week’s ‘makes’ have been ‘a multitude’ – sure, that’s what I’ve made to date!
Spot on with this write-up, I really suppose this web site needs far more consideration. I抣l most likely be again to read far more, thanks for that info.
My participation within the Operation Tackle That Bead Stash (I really have used only items in my stash) October challenge dedicated to Fireworks.
Step one to selecting out the right Jewellery pendant is to slim down and select which mixture she is going to like
higher. If the one you love wears extra silver and platinum jewelry it would be
a good suggestion to go with the silver and yellow gold jewelry pendants.
Thanks a lot for providing individuals with an extraordinarily marvellous possiblity to discover important secrets from this website. It can be very beneficial and as well , full of a great time for me personally and my office mates to visit your website really 3 times in one week to read through the latest guides you will have. Not to mention, I’m certainly satisfied considering the wonderful opinions you serve. Selected 1 points in this article are undoubtedly the most suitable I have had.
The kinds and shapes of jewelry in historical Greece such because the armring
(13th century BC), brooch (10th century BC) and pins (seventh century BC), have diversified extensively
because the Bronze Age as properly. Other types of jewellery
include wreaths, earrings, necklace and bracelets.
I am sure this piece of writing has touched all the internet viewers,
its really really nice article on building up new web site.
There are some fascinating deadlines on this article however I don抰 know if I see all of them center to heart. There is some validity but I will take maintain opinion until I look into it further. Good article , thanks and we would like extra! Added to FeedBurner as nicely
Every weekend i used to go to see this site, because i want enjoyment, since this this web page
conations actually nice funny data too.
I really like your blog.. very nice colors & theme. Did you make this website
yourself or did you hire someone to do it for you?
Plz answer back as I’m looking to design my own blog and would like to find out where
u got this from. thank you
Hi there, I found your website by means of Google while trying to find a relevant topic, your website came up,
it looks fantastic. I’ve bookmarked it in my google bookmarks.
What’s up, this weekend is fastidious designed for me,
as this point in time i am reading this enormous educational
post here at my house.
I do not know whether it’s just me or if everybody else encountering issues with your site.
It appears as though some of the text in your
posts are running off the screen. Can someone else please comment and let me know
if this is happening to them as well? This could be a problem with my
browser because I’ve had this happen before. Appreciate it