bgmulinari / B1SLayer

A lightweight SAP Business One Service Layer client for .NET
MIT License
122 stars 42 forks source link

Selecting a custom field #41

Closed ICESA-Proyectos closed 1 year ago

ICESA-Proyectos commented 1 year ago

If i try to select a user-defined fields like this

https://:50000/b1s/v1/BusinessPartners?$top=1&$select=CardCode, U_DOCUMENTO

{ "odata.metadata": "https://:50000/b1s/v1/$metadata#BusinessPartners", "value": [ { "CardCode": "PL17919001", "U_DOCUMENTO": "19001" } ] }

this code returns error B1SLayer.SLException: Property 'U_Documento' of 'BusinessPartner' is invalid

List bpList = await _serviceLayer .Request("BusinessPartners") .WithTimeout(TimeSpan.FromSeconds(3000)) .Select("CardCode, CardType, CardName, Address, Phone1, EmailAddress, U_Documento") .WithPageSize(10) .GetAsync<List>();

How can I select that kind of fieds?

jmartins-sh commented 1 year ago

Hello @ICESA-Proyectos, how are you doing?

So if you run the request in an app like Postman it will return correctly?

Did you try to use the name of your UDF in capital letters using the B1SLayer?

I am wondering if the UDF name could be case-sensitive, you know?

bgmulinari commented 1 year ago

Hi, @ICESA-Proyectos. Like @joaoantoniomartinsfilho said, the fields you select for the request are indeed case-sensitive. So if your field is called U_DOCUMENTO, this is what needs to be specified in your request when using B1SLayer.

bgmulinari commented 1 year ago

Hi, @ICESA-Proyectos. I'm closing the issue, but if you still need help, please let me know.

ICESA-Proyectos commented 11 months ago

Hi guys thanks for your help, I was out of office.

I never noticed the fields were case sensitive, after fixing that little detail the fields were imported without any problem

Thanks