Skip to Content
0
May 25, 2020 at 09:17 AM

CAP - using $expand on imported model

2208 Views

Hi all,

I am working on a scenario where i have regular service entities and also a imported service from a Success Factors API.

This is the query i wish to be executed on the remote service:

https://XXXXXXX.successfactors.com:443/odata/v2/EmpEmployment(personIdExternal='109031',userId='109031')?$expand=jobInfoNav&$select=userId,jobInfoNav/location

I have setup the entity on my cds definition like this:

@cds.persistence.skip @readonly entity EmpEmploymentJob as select from external.EmpEmployment mixin { EmplJob : Association to external.EmpJob on EmplJob.userId = userId } into { key userId, EmplJob.location,
};

In my implementation of the service, in the .on handler method for EmpEmploymentJob entity, this is the code i am running:

let cqn = SELECT.from(EmpEmployment).columns(["userId", 'jobInfoNav/location']).limit(20) let result = await tx.run(cqn) return resultHowever, i am getting back the userid, which is ok, but for the location information (from jobInfoNav navigation) i am unable to retrieve the data.Can you please help ?Thanks in advance.BRs,Rui