A Copilot Studio agent needs to collect a customer's order number (format: ORD-followed by 6 digits) before looking up order status. The developer wants the agent to automatically validate the format and re-prompt the user if they provide an invalid input. Which approach should the developer use?
Select an answer to reveal the explanation.
Short Explanation
Custom regex entities are built for exactly this — define the pattern once, and Copilot Studio automatically validates input against it and loops back for invalid responses. You don’t need Power Fx loops or flows.
Full Explanation
Copilot Studio entities define the type of data that a question node expects. Custom entities support regular expression patterns, which enables format validation with automatic re-prompting built in.
The approach that creates a custom entity with a regular expression pattern 'ORD-\d{6}' and uses that entity in the question node is correct. When the user provides input, Copilot Studio matches it against the regex. If the input doesn't match, the agent automatically re-prompts the user without the developer needing to write conditional logic or loop constructs. This is the most elegant and maintainable approach.
The approach using a Text type question node and adding a condition branch after it that checks the format with a Power Fx expression, looping back to re-ask if invalid, is incorrect. While it works functionally, it requires building a loop construct manually, such as redirect nodes back to the question. This is more complex to build and maintain than using a custom entity with built-in validation.
The approach using the built-in 'Number' entity type is incorrect. The Number entity validates that input is a number, but it doesn't enforce the 'ORD-' prefix or the specific 6-digit requirement. An order number like 'ORD-123456' includes letters and a hyphen, so the Number entity wouldn't work at all.
The approach adding a Power Automate flow that validates the order number format and returns a boolean, then checking the boolean in the next topic node, is incorrect. Calling a Power Automate flow for simple format validation adds latency from flow invocation overhead and operational complexity for a task that a regex entity handles natively in microseconds.