How to get a list of validation errors from bpmn-js-properties-panel?

Hello,

How can I access the validation errors from the bpmn-js-properties-panel? I would like to validate the each property in the properties panel once the user tries to deploy a model then display the errors to the user and not allow the model to be deployed.

image

I have tried to get them by document.getElementsByClassName but they only appear if the validation error is rendered on the page

Thank you,

Devin

Hi @Devin_B, welcome to the forum! The properties panel itself does not provide many validation errors itself, I think the ID validation you mention is the only one.

It rather uses tools like camunda/linting to show these errors via API. I think you can adopt this one to achieve what you want.

Thank you @Niklas_Kiefer for the help!

Do you know if I can simply turn off the ID validation on the properties panel?

Or are you able to tell me how this process ID validation error is being generated? How does it know that the process ID is unique or not? Is it somehow calling the camunda api to check against previously deployed process ID’s?

I don’t believe that the process ID has to be unique anyways since the most recent one would be set as an active process definition.

Thank you,

Devin

The properties panel does not validate against any Camunda engine, but only whether the ID is unique across the BPMN 2.0 diagram. We have a simple utility in place that is doing this check (see also this project).

To remove this validation, you would have to override the IdProps entry via custom properties provider. Notice that duplicated IDs inside a BPMN 2.0 diagram are not valid against the schema, and any (proper) BPMN engine will reject this.

Thank you Niklas, I appreciate the help!

I am having trouble overriding the IdProps with the custom properties provider. Are you able to provide me with some code?

Thanks,

Devin

Without inspecting your setup/code base, it will be hard to tell you what’s wrong. Can you share it, e.g. via CodeSandbox?

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.