umbraco / Umbraco.Forms.Issues

Public issue tracker for Umbraco Forms
29 stars 0 forks source link

User Agent 'Contains' Conditions for Workflow #1170

Closed marcemarc closed 4 months ago

marcemarc commented 4 months ago

Forgive me if I have misunderstood and this is all possible via a thing, that you can just do,, you know the thing thing but...

We have workflow steps that send emails when forms are submitted and I noticed the fancy conditions options on the Workflow configuration

image

And I was thinking it would be Super Cool if you could use the UserAgent string in the condition???

Whysers?

Well we use Ghostinspector to check key forms etc submit after a release all automatedly, but this can be super annoying for the editors of site, if they suddenly get 20 emails, and Ghostinspector has the word 'ghostinspector' tacked onto the UserAgent when it's running a test, and I bet other front end testing tools do similar?

and I was thinking it would be great to ignore a workflow based on a 'contains' in the User Agent string...

so people could run their testing framework scripts without really sending emails...

is this possible to write a custom workflow condition? (instead of writing a whole new custom workflow?) - is the pluggability that granular???

... I mean, I'll create a custom workflow step in the meantime, but just thought it might be a common ask / killer feature... or maybe I can implement an IWorkflowConditionalTest thing??

regards

Marc

AndyButland commented 4 months ago

As it stands workflows are conditional only on the value of fields, not any other factors (they have basically piggy-backed on the field display conditions that have existed in the product for a while).

But what you could do I guess here, is add a hidden field to your form, and use it to store the user agent based on a "magic string". And then use the "Contains" clause on that field to make the workflow conditional.

marcemarc commented 4 months ago

Thanks @AndyButland !

ooh yes, that would work, and if we didn't want to have the useragent submitted in the form fields then a custom Umbraco Forms Field that rendered a hidden field called IsTestMode (that we fangle to read the useragent or whatever logic determines testymodeness) - then we could just drop it into projects and onto forms neatly... and it make sense to editors too.