Jump to content

Adding Integers based on PCF Answers


Jamie Talbot

Recommended Posts

Hi All,

 

I am wanting to create a BPM that goes down specific routes based on PCF answers. In the PCF I have 4 questions ranked with a score of 0-3.

Based on the combined score of all 4 questions I'd like the BPM to go down a certain route.

 

Does any one have any ideas if that can be done? And if so how?

 

Best Regards

Jamie

Link to comment
Share on other sites

Hi @Jamie Talbot

Whilst we don't have any mathmatical based nodes that you can use in your Business Process, you can use Javascript to potentially achieve the result you. 

As an example, I have created a Progressive Capture with two questions:

image.png

 

image.png

 

image.png

 

Note that the Value of the dropdowns is numerical and the Display Value (e.g. Ten, Eleven, Twelve) is text - this can be anything you like. 

This results in something like this:

image.png

Now in my Business Process - I have used an Automated Task node to Update The Description with the calculation of the two values that were selected in my business process:

image.png

 

And to perform the Sum, I have used the following syntax in the Description Field. This is simply selecting the Raw Data (the Values) of the two Progressive Capture answers that were recorded. 

It's quite fussy, hence why I needed to put the " *1.00 " after each of the Capture Variables:

&[([functions.pcf("maths","field_1_value")] * 1.00 + [functions.pcf("maths","field_2_value")] * 1.00).toFixed(0)]

 

Then when raising the request, this has added together the values corrected and printed in the Description:

image.png

 

There may be more ways (possibly more elegant!) to use Javascript in this fashion, and it's not an ideal solution (in the future we may build Maths specific functions into the options available) but this should work in the meantime. You can add the answer to a Custom Field, and base various decisions off the back of this newly generated value.

Hope this helps

Bob

 

  • Like 2
Link to comment
Share on other sites

@Jamie Talbot and anyone else for that matter

I need to make you aware of some aspects regarding the use of match specific functions or any other JS functions in workflows. One of the Hornbill core concepts is codeless environment. This means that configuration does not rely in implementing any sort of code. While there are areas (such as this one) where code can be implemented to achieve various outcomes, please bear in mind this is not something that is officially supported.

You and anyone else can certainly implement solutions like this, using JS code in workflows configuration, but this is not something we would necessarily encourage our customers to do. Because we don't support this aspect of the configuration we cannot guarantee that it will always work. It works now, it might very well be working in the future or forever. But it is not a guarantee. Moreover, if it stops working in the future and at some point is not working anymore because we changed this functionality, we will not be able to support you or assist with this particular aspect.

However I do understand that there are various needs and you and other customers need the workflow to work in a certain way but ideally, whatever you would try to achieve should come with new or enhanced functionality that is in line with the codeless environment concept.

In summary, by all means, you can very well use this at this time, and there is a possibility that what you implemented here will always work but we cannot guarantee it will always work which means there is also a possibility that this configuration will stop working in the future. This is something I would advise to bear in mind when implementing solutions like this.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...