Why changesTo() function does't work?

jamesgo
Giga Contributor

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...
11 REPLIES 11

jamesgo
Giga Contributor

Breaking up worked... thanks! But why below doesn't work? though the wiki says changesTo needs object as its input parm, I do see a lot out of box business rules are working with values like below...



current.state.changesTo(-5)



CapaJC


Good job with that one Capa! But I'm with the OP on this one, I'm curious why it isn't working as a single condition.


CapaJC
ServiceNow Employee
ServiceNow Employee

I'm not sure, but my guess is that it's something specific to the fact that 1) the choice list is an *integer* choice list, and 2) it's a negative value. 'cuz I've seen changesTo work in many other situations.


CapaJC
ServiceNow Employee
ServiceNow Employee

Fine, you made me go digging 🙂 And my guess was right.

PRB574159: GlideElement.changesTo method gives wrong answer for a negative integer choice list value

Fixed for Calgary, so before that it'd be broken. Looks like it didn't make it into Calgary release notes because there were no customer Incidents logged against it.

So if you're on Calgary or later, and this is *still* broken, I'd recommend logging an Incident Could be a slightly different failure mode not covered by the fix for PRB574159.


jamesgo
Giga Contributor

You rock! yes we are still on berlin.


CapaJC