i want to change element’s name after element create.
this is my code and the error message:


i want to change element’s name after element create.
this is my code and the error message:


Hi @himyyy,
you are trying to execute a command during the execute phase of another command. This is not possible and therefore causes this error.
Please use the CommandInterceptor. Here you can find an example which should solve your use case easily:
class DefaultElementName extends CommandInterceptor {
constructor(eventBus, modeling) {
super(eventBus);
this.postExecute("shape.create", ({ context }) => {
const { shape } = context;
const { id } = shape;
modeling.updateLabel(shape, id);
});
}
}
thanks a lot, it works
Closing old topics. If you have a similar question or need further assistance, please create a new topic and link to this one for context. Thank you!