Answered by:
Accessing CRM 2011 WebService from Javascript using Onchange event of form in CRM 2011

Question
-
Hi All,I have a requirement like this
I have to generate account number, i have to fetch maximum account number from database and increment it by 1 and display it in the field
for this i want to access database using CRM web serivce called in clint side Javascript in OnLoad function of the account entity.
Can some body help me how to do it
Thanks and Regards
Ravi
Sunday, September 25, 2011 8:27 AM
Answers
-
There are lot of blogs available on how to access webservices through javascript.
You need to include the orderby clause to get the largest number.
You can use REST EndPoints or Soap services.
Here is link to use soap services with fetch xml
http://mileyja.blogspot.com/2011/07/convert-queryexpression-to-fetchxml.html
The above mentioned blog got hunderds of samples on how to use webservices with javascripts
here is link on how to generate auto number through plugins
http://www.codeproject.com/KB/cs/AutonumberingCRM2011.aspx
Here is link to do that through workflow.
http://leontribe.blogspot.com/2010/12/auto-numbering-using-workflow.html
I hope this helps.
Amreek singh Senior CRM Consultant CDC Praxa Sydney,Australia http://mscrmshop.blogspot.com/- Proposed as answer by Amreek Singh Sunday, September 25, 2011 9:06 AM
- Marked as answer by E Ravi kumar Sunday, September 25, 2011 1:41 PM
Sunday, September 25, 2011 9:06 AM -
Ofcourse you can. Calling webservices through Javascript will use xmlhttp
Here is lines from the first sample
var req = new XMLHttpRequest();
req.open("POST", SDK.SAMPLES._getServerUrl(), true)
I hope this helps.
You can also use retrievemultiple message to do that
http://mileyja.blogspot.com/2011/03/crm-2011-retrievemultiple-calls-in.html
I hope this helps.
Amreek singh Senior CRM Consultant CDC Praxa Sydney,Australia http://mscrmshop.blogspot.com/- Proposed as answer by Amreek Singh Sunday, September 25, 2011 1:05 PM
- Marked as answer by E Ravi kumar Sunday, September 25, 2011 1:41 PM
Sunday, September 25, 2011 1:05 PM
All replies
-
There are lot of blogs available on how to access webservices through javascript.
You need to include the orderby clause to get the largest number.
You can use REST EndPoints or Soap services.
Here is link to use soap services with fetch xml
http://mileyja.blogspot.com/2011/07/convert-queryexpression-to-fetchxml.html
The above mentioned blog got hunderds of samples on how to use webservices with javascripts
here is link on how to generate auto number through plugins
http://www.codeproject.com/KB/cs/AutonumberingCRM2011.aspx
Here is link to do that through workflow.
http://leontribe.blogspot.com/2010/12/auto-numbering-using-workflow.html
I hope this helps.
Amreek singh Senior CRM Consultant CDC Praxa Sydney,Australia http://mscrmshop.blogspot.com/- Proposed as answer by Amreek Singh Sunday, September 25, 2011 9:06 AM
- Marked as answer by E Ravi kumar Sunday, September 25, 2011 1:41 PM
Sunday, September 25, 2011 9:06 AM -
Hi Amreek,
Thanks for your reply,
Can i do the same thing using XmlHttp? if not why we will not be able to do can you please explain me, it will help me a lot.
Thanks and Regards
Ravi
Sunday, September 25, 2011 10:00 AM -
Ofcourse you can. Calling webservices through Javascript will use xmlhttp
Here is lines from the first sample
var req = new XMLHttpRequest();
req.open("POST", SDK.SAMPLES._getServerUrl(), true)
I hope this helps.
You can also use retrievemultiple message to do that
http://mileyja.blogspot.com/2011/03/crm-2011-retrievemultiple-calls-in.html
I hope this helps.
Amreek singh Senior CRM Consultant CDC Praxa Sydney,Australia http://mscrmshop.blogspot.com/- Proposed as answer by Amreek Singh Sunday, September 25, 2011 1:05 PM
- Marked as answer by E Ravi kumar Sunday, September 25, 2011 1:41 PM
Sunday, September 25, 2011 1:05 PM -
Hi Amreek,
Thanks a lot,
I am going through lot of information which you have provided.
Thank you very much, hopefully i will solve it succesfully
Regards
Ravi
Sunday, September 25, 2011 1:38 PM