Why changesTo() function does't work?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-24-2013 08:18 AM
I have a UI action to set change state to pending:
current.state = '-5';
then I use a business rule to check it:
if (current.state.changesTo('-5'))
why this doesn't work? the condition always return false...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-24-2013 08:38 AM
Can you show the rest of your business rule? Is this an onbefore or an onafter business rule?
current.state.changesTo() is the correct syntax and should be working.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-24-2013 08:43 AM
it is a before business rule:
function checkResetConditions() {
var doReset = false; //default to no reset
if (current.state.changesTo(-5)){
doReset = true; //enable the reset
}
return doReset;
}
Now even I put current.state.changesTo into the same UI aciton script, it still returns false...
current.state = -5;
current.update();
gs.log("state change: " + current.state.changesTo(-5));
Aaron
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-24-2013 08:38 AM
if (current.changesTo(-5)), no quotes.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-24-2013 08:49 AM
Try breaking it up, and see if that gets around whatever the issue is. Try using:
current.state.changes() && current.state == -5