rules task written on mvel not building and throwing java compilation error

I have this rules task written on mvel dialect, the globalorder variable is defined on my business process and specified on the TaskData I/O section.

For the onEntry section I wrote, on MVEL dialect:

package com.myspace.ordersdemo;

import java.lang.Number; import com.myspace.ordersdemo.Order globalorder

rule "DiscountApplying" dialect "mvel" when Order( ) ( Order( amount > 200 ) ) then globalorder.DiscountApplying = true end

When I try to deploy on my local business-central, I get this strange error, can somebody give me any clues on this?

"ERROR","[KBase: defaultKieBase]: Unable to Analyse Expression package com.myspace.ordersdemo;import java.lang.Number;import com.myspace.ordersdemo.Order globalorder;rule ""DiscountApplying""; dialect ""mvel""; when; Order( ); ( Order( amount > 200 ) ); then globalorder.DiscountApplying = true;end:[Error: class not found: package com.myspace.ordersdemo;import java.lang.Number;import com.myspace.ordersdemo.Order globalorder;rule ""DiscountApplying"";
dialect ""mvel""; when; Order( ); ( Order( amount > 200 ) ); then globalorder.DiscountApplying = true;end][Near : {... import com.myspace.ordersdemo.Order g ....}]

Upvotes: 0

Views: 92

Answers (1)

Abbas Kararawala
Abbas Kararawala

Reputation: 1254

The snippet that you have provided actually belongs to drools which will throw syntax when you run as MVEL expression inside OnEntry Script, either define this inside a separate drl file, add an agenda and call it from a separate rule task or fix your on entry script to use MVEL syntax. For example, a valid syntax in your case would be:

If(globalorder.amount > 200) {
    globalorder.DiscountApplying = true;
}

MVEL documentation may help you with appropriate syntax

Upvotes: 0

Related Questions