How to use LastModifiedDateTime/LastModifiedOn fields correctly in SuccessFactors Odata query
In SuccessFactors Integration, there is often a requirement to fetch delta records from SuccessFactors. This can be achieved by using OData APIs and applying filter on LastModifiedDateTime/LastModifiedOn fields.
This blog will explain how to use LastModifiedDateTime/LastModifiedOn field in the filter and how different response from SuccessFactors is received based on the position of lastModifiedOn field in the filter expression.
Problem Statement: –
Fetching records from Odata SF APIs in delta mode even though LastModifiedOn/LastModifiedDateTime filter is not satisfied. This issue can happen with any Odata entity in SuccessFactors and this blog will help to understand why it happens and how to get rid of it.
Consider below example of an employee in SuccessFactors.
There is a future dated changed on Job Information for this employee (Effective date – 1st March 2023). Please refer to the below screenshot.
Previous Event of New Hire was also added in past. PFB screenshot.
Now lets try to query this employee with filter as LastModifiedOn >= ‘2023-02-01T00:00:00Z’. Please note that I am running this query on 10th Feb 2023.
Please find the response below from SuccessFactors
It is evident that despite the LastModifiedOn field value failing to meet the filter condition, the record has persisted in the response. Anyone paying attention will notice that the response includes the current effective record, even though it doesn’t meet the filter condition. This is because of the applied filter condition.
The position of the queried field (in this case, LastModifiedOn) plays a crucial role in determining the outcome. If the queried field is located on the left-hand side of the operator, the search scope expands to include both entity records and audit logs. In the above mentioned case, the entity record failed to satisfy the filter condition. But an audit log had a future dated record which was satisfying the filter condition. That is why the response featured the employee’s details, comprising the current effective data.
However, if the field is placed on the right-hand side of the operator, only entity records will be considered in the search scope. Thus, executing the query in this manner would not give any response from SuccessFactors. Refer to the below screenshots.
Response from SF: –
Hence the placement of the lastModifiedOn field can be changed to meet your specific requirements.
For more detailed information refer to this link
This is how LastModifiedOn/LastModifiedDateTime filter conditions in SuccessFactors OData APIs can be used efficiently to meet the requirements.
Hope this blog helps. 😊
Senior Consultant, Veritas Prime Labs
Good to know about Audit log and Entity log change. I recently faced similar issue. Thanks for sharing!