SAP Knowledge Base Article - Public

2577232 - How to Fetch Last Changes on Contact Collection Using OData

Symptom

You want to use OData to query the latest Changed On date from changes made on Contacts.

Environment

SAP Hybris Cloud for Customer 1711 or higher.

Reproducing the Issue

  1. Query the ContactCollection from c4codata service using your internet browser: https://myXXXXXX.crm.ondemand.com/sap/c4c/odata/v1/c4codata/ContactCollection?$filter=ContactID eq 'XYZABC'
  2. You will not see the latest dates on Changed On property.

Cause

Changes performed on contacts will not update the 'Changed On' date present in ContactCollection, as this property is a part of the business object Business Partner and Contacts object is a cross business object relation under that.

Resolution

To fulfill this requirement you can create a new Custom OData Service on business object 'BusinessPartner' and add the 'Last Changed On' property through the following path: DefaultIsContactPersonForBusinessPartnerRelationship --> SystemAdministrativeData --> LastChangeDateTime.
The above property will have the 'LastChangedOnDateTime' of the values you have changed on Contacts object.

See Also

If you need help to create Custom OData Services, please refer to the link below:

https://help.sap.com/viewer/26fdb8fadd5b4becb5c858d92146d0e0/1708/en-US/8e4220fa6dc943ef891fb3d0e91515d3.html

Keywords

odata, custom, contact, changedon, contactcollection , KBA , LOD-CRM-INT-API , OData API (C4C Only) , LOD-LE-BP-BP , Business Partner , How To

Product

SAP Cloud for Customer add-ins all versions