Problem with sdk.FilterGroup addSchemaColumnInFilterWithParameters
19:58 Jan 11, 2025
Please tell me what I am specifying wrong when requesting the Id list:
var changedSchemaName = "Contact"; var fieldName = "Address"; changedRecordsList = ["xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"]; // can be more then 1000 const filterGroup = new sdk.FilterGroup(); filterGroup.addSchemaColumnInFilterWithParameters(sdk.ComparisonType.Equal, "Id", changedRecordsList); // I read the old values first. const changedModel = await sdk.Model.create(changedSchemaName); const resultChanging = await changedModel.load({ attributes: ["Id", fieldName], parameters: [{ type: sdk.ModelParameterType.Filter, value: filterGroup }] });
As a result, I get an invalid filter error:
ye {headers: N, status: 500, statusText: 'Internal Server Error', url: 'https://................./DataService/json/SyncReply/SelectQuery', ok: false, …}
- error: {responseStatus: {
- ErrorCode: "NullReferenceException"
- Errors: []
- Message: "Object reference not set to an instance of an object."
- }, rowsAffected: -1, nextPrcElReady: false, success: false}
- headers: N {normalizedNames: Map(0), lazyUpdate: null, lazyInit: ƒ}
- message: "Http failure response for https://................./DataService/json/SyncReply/SelectQuery: 500 Internal Server Error"
- name: "HttpErrorResponse"
- ok: false
- status: 500
- statusText: "Internal Server Error"
- url: "https://................./DataService/json/SyncReply/SelectQuery"
Thanks/
Like
1 comments
11:31 Jan 13, 2025
I figured it out. filterGroup does not have an "items" property. The example given at https://customerfx.com/article/querying-data-using-filter-conditions-vi… solves this problem:
const newCustomerFilters = Object.assign({}, filterGroup; newCustomerFilters.items = filterGroup.items;
adds this property. And then it works correctly.
Show all comments