-1

using Javascript need to get an account id by phone number , i realize that it can be done using Web API but i can't find any examples after searching.

2 Answers2

0

Here's a reference page you can start from https://msdn.microsoft.com/en-us/library/gg334279.aspx, if you have done it using the REST API in 2013 it looks as if it's done in a similar way.

Rickard N
  • 408
  • 3
  • 8
0

Here is the URI that you're looking for:

[Organization URI]/api/data/v8.2/api/data/v8.1/accounts?$filter=telephone1 eq '"+ phoneNumber +"' or telephone2 eq '"+ phoneNumber +"' or telephone3 eq '"+ phoneNumber +"' or mobilephone eq '"+ phoneNumber +"' &$select=accountid"

telephone1, telephone2, telephone3 and mobilephone are the types of phone numbers that exists in Dynamics. If you have custom fields on account entity, add it as a filter.

Hubert Solecki
  • 2,611
  • 5
  • 31
  • 63