diff --git a/lib/model/query/entities.js b/lib/model/query/entities.js index b6b9ff2df..d0594625e 100644 --- a/lib/model/query/entities.js +++ b/lib/model/query/entities.js @@ -278,7 +278,7 @@ const _processSubmissionEvent = (event, parentEvent) => async ({ Datasets, Entit const dataset = (await Datasets.get(form.get().projectId, entityData.system.dataset, true)) .orThrow(Problem.user.datasetNotFound({ datasetName: entityData.system.dataset })); - // Or update entity + // Try update before create (if both are specified) if (entityData.system.update === '1' || entityData.system.update === 'true') try { await Entities._updateEntity(dataset, entityData, submissionId, submissionDef, submissionDefId, event); diff --git a/test/integration/api/entities.js b/test/integration/api/entities.js index 0a5079168..7f801454b 100644 --- a/test/integration/api/entities.js +++ b/test/integration/api/entities.js @@ -2203,6 +2203,8 @@ describe('Entities API', () => { .expect(200) .then(({ body: logs }) => { logs[0].action.should.be.eql('entity.error'); + logs[0].details.problem.problemCode.should.be.eql(400.2); + logs[0].details.errorMessage.should.be.eql('Required parameter label missing.') logs[1].action.should.be.eql('submission.create'); }); }));