Is it possible to use javascript in the value field of a Flow record trigger condition?

stuartgriffiths
Tera Expert

I have attempted to convert some async business rules to flows. The business rule filter conditions included some javascript in the values, for example javascript:gs.getProperty('my_property_name')

find_real_file.png

The business rules trigger as expected.

However, if I configure the same condition into the flow, like this...

find_real_file.png
...when I minimise the Trigger section of the Flow form, the summary of the trigger shows 'undefined', e.g. 'Correlation Display is undefined'.

find_real_file.png

Testing shows that the flow does not trigger.

If I amend the conditions to remove the javascript from the condition and replace it with static value, the Flow triggers.

Can anyone advise if what I'm trying to do is supported in Flow Designer?

Thanks.

Stuart.

1 ACCEPTED SOLUTION

stuartgriffiths
Tera Expert

ServiceNow have confirmed this is not currently possible with Flow trigger filter conditions. They've suggested raising an enhancement if I feel the functionality would be of wider benefit. I'm happy to take feedback on that through this thread.

To achieve my desired outcome I used a hybrid approach, using business rules to act as the trigger - allowing me to use javascript in the filter conditions where required  - and adding a scripted call to a subflow (code snippet tool in flow designer makes this pretty easy).

It means there are more 'moving parts' in the solution that if I'd used either just Flow or just business rules, but I'm keen to leverage Flow with an eye on future support and the direction of travel of the platform towards Flow Designer-based solutions.

View solution in original post

7 REPLIES 7

asifnoor
Kilo Patron

can you try removing javascript and check

gs.getProperty('my_property_name') 

SanjivMeher
Kilo Patron
Kilo Patron

If Asif's suggestion doesn't work, you may need to create an action to get the value as an output and use it in the condition


Please mark this response as correct or helpful if it assisted you with your question.

stuartgriffiths
Tera Expert

As I've said in the question body, if I replace the the javascript with a static value, the flow triggers. That's not the solution I need.

The context is I want to make triggering as precise as possible - similar to how I can use javascript in a business rule condition value - and not rely on triggering the flow to then apply further conditions in an action.

If javascript doesn't work, thats the best option. You can re-use that action in other flows as well, where input will be the property name and output will be the value. I don't see a problem doing that.


Please mark this response as correct or helpful if it assisted you with your question.