on 2022 Nov 28 8:36 AM
Hi,
I'm using Cloud SDK for Javascript to fetch some data from SF OData API. It's working smoothly. ( Foundation platform, User Management API )
const getUserData = async function (userId) {
const userApi = new UserApi();
const resp = await userApi
.requestBuilder()
.getAll()
.select(
userApi.schema.USER_ID,
userApi.schema.JOB_CODE,
userApi.schema.DIVISION,
userApi.schema.CUSTOM_01,
userApi.schema.CUSTOM_02,
userApi.schema.CUSTOM_03,
userApi.schema.CUSTOM_04,
userApi.schema.TOTAL_TEAM_SIZE,
userApi.schema.DEFAULT_FULL_NAME,
userApi.schema.LOCATION,
userApi.schema.TITLE
)
.filter(userApi.schema.USER_ID.equals(userId))
.execute({ destinationName: _dest });
return resp;
};
But when I add a navigation property to select at the bottom of the TITLE like;
userApi.schema.HR
it's throwing an error (Cannot read properties of undefined (reading '_fieldName'))
When I add it like this;
userApi.schema.HR.select(userApi.schema.USER_ID)
It also throws an error ( Cannot read properties of undefined (reading 'select') )
I also couldn't find a specific schema for that Navigation Property (HR).
Any ideas how to get navigation properties ?
I guess Frank showed the key to solve the issue, which is the initialization of the "userApi"
const userApi = service.pltUserManagementService().userApi
In general, this documentation shows how to execute an odata request.
In addition, for odata v2 specific details you can check this documentation, where you can find e.g., how to "$select" properties here.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
71 | |
10 | |
8 | |
7 | |
7 | |
6 | |
6 | |
6 | |
6 | |
5 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.