Your expected behavior is not correct since you are not updating/modifying the fact after you change one of its properties. By default Drools doesn&#39;t know when a fact is modified so you have to explicitly let him know by using the modify() automagic function.<div>

<br></div><div>Best Regards  <br clear="all"><br>XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX<br><br>Esteban Aliverti<br>- Blog @ <a href="http://ilesteban.wordpress.com" target="_blank">http://ilesteban.wordpress.com</a><br>


<br><br><div class="gmail_quote">On Mon, Oct 29, 2012 at 11:59 PM, kina06 <span dir="ltr">&lt;<a href="mailto:reachkn6@gmail.com" target="_blank">reachkn6@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

I have inserted 3 accounts into knowledge session with the following account<br>
statuses 1-NEW, 2-TRANSFER,3-CLOSE.<br>
<br>
EXPECTED BEHAVIOR:<br>
As per below given rules, first rule should change all of them to &#39;pending&#39;<br>
status, so second rule should never fire and third rule always fire for<br>
above 3 accounts.<br>
<br>
ACTUAL BEHAVIOR:<br>
second rule is fired for account with new status, i.e. the first one, but in<br>
the system out its status is shown as PENDING before i set it to ERROR.<br>
<br>
Can&#39;t figure out what&#39;s wrong with this, does it has to do anything with<br>
MVEL vs JAVA usage? I mean in when claues it&#39;s mvel and in then clause it&#39;s<br>
java, so is that causing problem?<br>
<br>
<br>
rule &quot;Rule1&quot;<br>
salience -1<br>
when<br>
        account : Account();<br>
then<br>
    System.out.println(&quot;Ac state rule1 before change &quot;+<br>
account.getAccountStatus());<br>
      account.setAccountStatus( &quot;PENDING&quot; );<br>
      System.out.println(&quot;Ac state rule1 after change &quot;+<br>
account.getAccountStatus());<br>
end<br>
<br>
<br>
rule &quot;Rule2&quot;<br>
salience -2<br>
     when<br>
         account : Account(StringUtils.equals(accountStatus,&quot;NEW&quot;))<br>
         then<br>
            System.out.println(&quot;Ac state RuleNo2 before change &quot;+<br>
account.getAccountStatus());<br>
         account.setAccountStatus(&quot;ERROR&quot;);<br>
         System.out.println(&quot;Ac state RuleNo2 after change &quot;+<br>
account.getAccountStatus());<br>
end<br>
<br>
rule &quot;Rule3&quot;<br>
salience -3<br>
     when<br>
         account : Account(StringUtils.equals(accountStatus,&quot;PENDING&quot;))<br>
         then<br>
            System.out.println(&quot;Ac state  &quot;+ account.getAccountStatus()+ &quot;.<br>
YES<br>
this is expected&quot;);<br>
end<br>
<br>
<br>
<br>
--<br>
View this message in context: <a href="http://drools.46999.n3.nabble.com/Field-value-is-different-when-and-then-section-very-strange-Is-it-mvel-vs-java-issue-tp4020550.html" target="_blank">http://drools.46999.n3.nabble.com/Field-value-is-different-when-and-then-section-very-strange-Is-it-mvel-vs-java-issue-tp4020550.html</a><br>


Sent from the Drools: User forum mailing list archive at Nabble.com.<br>
_______________________________________________<br>
rules-users mailing list<br>
<a href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a><br>
<a href="https://lists.jboss.org/mailman/listinfo/rules-users" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</a><br>
</blockquote></div><br></div>