Search code examples
botframework

why condition field only accepts pre-built functions?


It seems that a condition in BotFramework Composer only accepts pre-built functions and not templates.

If we have on common.lg a template like this:

# ValidID(text)
- ${length(text)==9 && isMatch(text, ‘[A-Za-z]{1}[0-9]{7}’)}

We can use in SendMessage like this for example:

- User’s Id: ${user.ID}, validation: ${ValidID(user.ID)}

But, why we are not permitted to use our custom function ‘ValidID’ inside the condition textbox of a Condition Branch/if for example?

Condition [${ValidID(user.ID)==true]

When we try to use in condition Composer says that ValidID is not a pre-built function or user scope variable...

This is a very frustrating limitation, because we have a lot of templates that we can call other templates in order to simplify complex validations and then, when we need to use this validations in a condition, we need to expand all templates to use only pre-built functions and templates loses its utility.

Someone knows anyway to work arround on this?

We tried to use a SetProperty box to assign our template to user scope variable, but it seems we have the same limitation.

We will appreciate any type of instructions or help to accomplish our expectations on this, thanks to all people that works everyday on BotFramework to make it better.


Solution

  • This is a bit of a strange question for Stack Overflow, since you're asking a "why" question that only the creators of the technology could answer rather than a "how to" question that any user of the technology could answer. If I had to guess I'd say this was an oversight, which would imply that you should raise this as a bug. On the other hand if you think this is intended behavior then you should raise this as a feature request.

    I doubt there's a "workaround" beyond expanding the templates like you've said.