Monday, January 6, 2025

How to Select Required Fields in D365 OData URL

How to Select Required Columns in a D365 OData URL.



1. When using the GET operation, the system retrieves all the fields available in the data entity by default.

2. In real-time scenarios, we need only specific fields for our process. To achieve this, we can use the $select keyword in the GET URL.

3. Using $select, you can specify the fields that you want to retrieve.
?$select=FieldNames

4. Below is an example URL I used for testing:
{{resource}}/data/VendorGroups?Cross-company=true
    &$select=dataAreaId,VendorGroupId,DefaultPaymentTermName,Description


5. Below is the output:





In the above URL, no filter was applied. If you want to retrieve a specific record, you can apply a filter by adding the $filter keyword to the URL.


I applied a filter using the dataAreaId and vendGroupId fields.
{{resource}}/data/VendorGroups?Cross-company=true&$filter=dataAreaId eq 'USMF' 
and VendorGroupId eq '10'
&&$select=dataAreaId,VendorGroupId,DefaultPaymentTermName,Description


Keep Daxing!!

No comments:

Post a Comment