+ Start a Discussion
CafeCafe 

Workflow based on changing value in a field

I'd like to create a workflow rule that automatically notifies certain people when an account owner is changed. I would also like to do this for the billing address. I can't figure out a way to base a workflow rule on a value in a field being modified. Has anyone been able to do this?

 

Thanks in advance!!

Best Answer chosen by Admin (Salesforce Developers) 
NPMNPM

To use ISCHANGED you need to change the Rule Evaluation as mentioned.  The rule will then only trigger if the Owner is changed. The Rule will be evaluated each time the record is saved - but only trigger if the formula evaluates to True.

All Answers

SteveMo__cSteveMo__c

You should be able to do it with this:

 

 

ISCHANGED(fieldname)

 

 

 

 

could you paste the source code you're currently using?

CafeCafe

My formula looks like this so far:

 

 

AND( ISCHANGED( OwnerId ), NOT(ISNULL( IntacctID__c )))

Error: Function ISCHANGED may not be used in this type of formula
 
I tried using the "Ownership" field also, and am getting the same error message.

 

SteveMo__cSteveMo__c
I think the second half of your code is where the problem is.  Lemme play around with it, and see what I can find.  What is the datatype of your "IntacctID__c" field?
CafeCafe
It's a text field. We populate it with a number generated by our accounting software when we synch a customer. I tried that half of the formula on its own and there wasn't a syntax error, so I don't think that's the problem.
cardozamancardozaman

Hi Cafe,

 

Change your criteria from when a record is created or updated and has not previously met etc etc....to fire on every time a record is created or edited.

 

Your error will go away.

 

...cardozaman

NPMNPM

It also partly might be that ISNULL does not work for Text fields.  For Text fields us the LEN() function.  Use LEN (field name) = 0 to check for null

or LEN (field name) > 0 for not null

of NOT(LEN (field name) = 0 for not null

cardozamancardozaman

Thanks NPM... I hadn't even really looked at the content of the formula..... I just know the error above is from the crtiteria setting.

 

You are correct.   I think Cafe could also use "" instead of ISNULL....  I'd have to do a quick test, but pretty sure that will work as well.

 

 

NPMNPM
I definately agree on the source of the error, should have mentioned that in my post.  The text field null issue never gives a syntax error but the formula never works as intended if you use ISNULL with a text field.  It is noted in ISNULL description in Help and Training though -  Text fields are never null so using this function with a text field always returns false.
CafeCafe

I'm still getting the error message. When I try just the half of the formula including the IntacctId__c field with either NULL() or LEN(), I'm getting no syntax errors. This is a field that was downloaded from the app exchange, and it is shown as a text field, but populated by numbers.

 

When I try just ISCHANGED(OwnerId) or ISCHANGED(Ownership), I am still getting the same error message: Function ISCHANGED may not be used in this type of formula.

NPMNPM

Please confirm you have set the evaluation rule criteria to "Every Time a Record is Created or Edited".

 

We/I may have caused confusion with the ISNULL discussion. 

cardozamancardozaman

Did you change your criteria from when a record is created or updated and has not previously met etc etc....to fire on every time a record is created or edited?

 

that's what causes that error.

 

...cardozaman

CafeCafe
The evaluation rule criteria is "Every Time a Record is Created or Edited". I don't want it to be every time a record is edited--only when the owner is changed.
NPMNPM

To use ISCHANGED you need to change the Rule Evaluation as mentioned.  The rule will then only trigger if the Owner is changed. The Rule will be evaluated each time the record is saved - but only trigger if the formula evaluates to True.

This was selected as the best answer
CafeCafe
Awesome! It's working now. It tested tried and true. Thanks for all the help, everyone!