0

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 ....}]

  • Looks like you're confusing drools with MVEL. This thread might help you getting started - https://stackoverflow.com/questions/28473204/drools-differences-between-the-mvel-and-java-dialects – Abbas Kararawala Sep 06 '22 at 03:44

1 Answers1

0

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

Abbas Kararawala
  • 1,254
  • 12
  • 19