fix: correct subjectFilterRequest format for Ivanti FP workflow API

The API expects { subject: 'hostFinding', filterRequest: { filters } }
not a flat filter object. Confirmed working via direct curl test —
workflow ID 33418832 created successfully.
This commit is contained in:
jramos
2026-04-08 12:18:41 -06:00
parent 5d417edf82
commit 729dada05c

View File

@@ -75,19 +75,19 @@ function validateFpWorkflowForm(body) {
/**
* Builds the subjectFilterRequest JSON for the Ivanti FP workflow endpoint.
* This is a stringified filter that tells Ivanti which host findings to include.
* Format matches the search endpoint filter schema: { filters, projection, sort }
* Format: { subject, filterRequest: { filters } }
*/
function buildSubjectFilterRequest(findingIds) {
return JSON.stringify({
subject: 'hostFinding',
filterRequest: {
filters: [{
field: 'id',
exclusive: false,
operator: 'IN',
value: findingIds.map(id => String(id)).join(',')
}],
projection: 'internal',
sort: [{ field: 'id', direction: 'ASC' }]
}]
}
});
}