bpmnServer / bpmn-server

BPMN 2.0 server for Node.js , providing modeling, execution, persistence and monitoring for Workflow. along with sample UI. Intended to be developers workbench for BPMN 2.0
MIT License
186 stars 48 forks source link

Condiitonal Expression #170

Closed MaheshkumarSundaram closed 9 months ago

MaheshkumarSundaram commented 10 months ago

Hi @ralphhanna,

Conditional Expression evalution seems to be wrong.

image

image

In my appServices.ts, I have the below:

async TestServiceCall(input, context) {
        const { isAbort } = input;
        if (isAbort === '0') {
            context.item.data.ErrorCode = null;
        } else {
            context.item.data.ErrorCode = 'Abort';
        }
    }

Result:

image

Although the condition is not true, it's taking the wrong flow path.

Please look into this? Thanks.

ralphhanna commented 10 months ago

What release are you using In 2.0.0 you need to add $ in condition

MaheshkumarSundaram commented 10 months ago

Thanks @ralphhanna. Is $ symbol required in front of start or end inline scripts in Execution Listeners too as they are JS expressions?

ralphhanna commented 10 months ago

As a result of your question, I had a change of mind!!!! Sorry, It looks much simpler not to add '$' for condition and others that are explicit JavaScripts '$' is only required for:

Please see https://github.com/bpmnServer/bpmn-server/blob/rel2.0.0/docs/scripting.md and review Awaiting your feedback Thanks

MaheshkumarSundaram commented 10 months ago

Hi @ralphhanna,

Sorry, It looks much simpler not to add '$' for condition and others that are explicit JavaScripts

I agree. The document seems nice which covers all the usecases.

Just to clarify on your example for Input/Output, now the latest version supports all types of Input/Output -> Text, List, Map & JavaScript explicitly instead of using Text for all types. Am I right?

Thanks.

MaheshkumarSundaram commented 10 months ago

@ralphhanna Following the above, I tested these recent changes.

I don't see any problems with functionalities. But there is a very minor issue when displaying the instance details.

image

Although I provided key/value pairs for the Map variable in the model, the instance details doesn't display it while all other types of data get displayed properly. This problem pertains solely to the UI aspect. Functionally, I can read those inputs and process accordingly without any problem.

image

Thanks.

ralphhanna commented 10 months ago

Correct, new release support all allowed types list,map,text and Script Thanks for noticing it, JSON.Stringify does not support map, so now I use array, here is the result

image

MaheshkumarSundaram commented 10 months ago

@ralphhanna, Could you please commit this change? Thanks

ralphhanna commented 10 months ago

Done

MaheshkumarSundaram commented 10 months ago

Hi @ralphhanna, I don't think the last two commits by you are reflected in the npm package. Could you please verify this? Thanks.

ralphhanna commented 10 months ago

Done, Thanks