Hi All,
I have created one custom service to fetch customer details(selected fields: AccountNum, FirstName, LastName) of all customers for testing purpose to implement the similar procedure for our integration projects.
Created datacontract, service class, service and then service group. And my service is working fine and I am able to fetch data from AX using authentication token using url such as:
https://*****devaos.cloudax.dynamics.com/api/services/TestIntegrationgrp/CustCustomerServ/Getcustomers
Code that I have used:
class CustCustomerSer
{
//Fetch customer
[SysEntryPointAttribute(true),AifCollectionTypeAttribute('return', Types::Class, classStr(CustCustomerDC))]
public List GetCustomers()
{
CustCustomerDC objcontract;
CustTable objcusttable;
List custList = new List(Types::Class);
while select * from objcusttable
{
objcontract = new CustCustomerDC();
objcontract.parmcustaccount(objcusttable.AccountNum);
if(objcusttable.partyType() == dirpartytype::Person)
{
objcontract.parmcustFName(DirPersonname::find(objcusttable.party).FirstName);
objcontract.parmcustLName(DirPersonname::find(objcusttable.party).LastName);
}
else
{
objcontract.parmcustFName(dirorganizationName::find(objcusttable.party).Name);
}
custList.addEnd(objcontract);
}
return custList;
}
Then, I was trying to get the filtered records(same as we do for data entities where we can apply Odata filters). But I am unable to filter records, I tried many things such as
https://******.cloudax.dynamics.com/api/services/TestIntegrationgrp/CustCustomerServ/Getcustomers(AccountNum="004002")
I wonder if it is possible??Or I might be missing something in code.
Also, I am trying to write some method to insert the record using 3 parameters as in mentioned code but unable to do.
Thanks in Advance!