nocode-js / sequential-workflow-editor

Powerful workflow editor builder for any workflow designer.
https://nocode-js.com/
MIT License
87 stars 8 forks source link

How can I dynamically update the task name #41

Closed NexPlex closed 1 month ago

NexPlex commented 2 months ago

How can I dynamically update the task name to include one of the property values? Here is my model. I'm trying to have the name = 'Say or Ask ' + property('question') value.

export const questionTaskModel = createStepModel('question', 'task', step => { step.category('Questions'); step.name().value(createGeneratedStringValueModel({ generator(context) { return 'Say or Ask' ; } })); step.property('question').value( createChoiceValueModel({ choices: ['Text'], defaultValue: '' }) ).label('Script'); step.property('question_id') .value(createStringValueModel({

}))
.label('Question ID');

});

b4rtaz commented 2 months ago

Hello @NexPlex, you should use the Generated String Value Model. Here is a nice example: https://github.com/nocode-js/nocode-platform-boilerplate/blob/main/src/lib/workflows/endpoint/model/steps/flow/forStepModel.ts

  step
    .name()
    .dependentProperty('from')
    .dependentProperty('to')
    .dependentProperty('delta')
    .value(
      createGeneratedStringValueModel({
        generator(context) {
          const from = context.formatPropertyValue('from', StepNameFormatter.formatDynamic);
          const to = context.formatPropertyValue('to', StepNameFormatter.formatDynamic);
          const delta = context.formatPropertyValue('delta', StepNameFormatter.formatDynamic);
          return `${from} < ${to}, Δ${delta}`;
        }
      })
    );