2

I have a workflow that I've created that will populate a text field with a URL when the record is updated.

My workflow rule evaluation criteria is: Evaluate the rule when a record is created, and every time it’s edited

my rule criteria is: AND ( MyField__c <> "MyValue" )

I'm trying to use an "AND" condition to only fire the workflow when "MyField" is not equal to "MyValue" and "MyField" has changed either from Null or blank to a value or the value has changed.

"MyField" is not set on the record creation. It only gets populated on update thru APEX. I've tried using ISCHANGED and PRIORVALUE, but neither of those work. Any ideas? I'm trying to prevent my workflow from firing every single time the record is updated.

Thanks for any help.

2
  • would be helpful if you showed the trigger code. if the value is being set there, best to see that, too.
    – pchittum
    Commented Oct 21, 2014 at 21:30
  • Peter, I can include the code, but there is a lot and it might not be much help without actually running debug statements to follow the execution path.
    – Dman100
    Commented Oct 21, 2014 at 22:17

3 Answers 3

1

You can try to change your workflow criteria to everytime a record is created or edited to subsequently meet your criteria.

1

There is function ISCHANGED Try this:

AND ( 
ISCHANGED(MyField__c),
ISBLANK(PRIORVALUE(MyField__c)),
MyField__c <> "MyValue" )
3
  • Hi Eric, thanks for the suggestion. I just gave that a try and still doesn't work? It seems that ISCHANGED and PRIORVALUE don't work until after a value is already there?
    – Dman100
    Commented Oct 21, 2014 at 21:58
  • When you say does not work, what are you doing and what do you expect, then what actually happens?
    – Eric
    Commented Oct 21, 2014 at 22:09
  • There is underlying code that copies content version data to a custom literature object. The code copies those values over on update, so the lit record is created, code runs an update and copies the values over. The workflow should fire to generate a unique URL from some field values on the lit record. If I just use the original rule criteria, the workflow run fine. I wanted to add additional criteria to prevent the workflow from firing every time the lit record is edited.
    – Dman100
    Commented Oct 21, 2014 at 22:14
0

Like @ankush said, change your evaluation criteria to 'created, and any time it’s edited to subsequently meet criteria'.

Then,

  • Run this rule if the following 'Criteria are met'

    • Field: MyField__c
    • Operator: not equal to
    • Value: MyValue

    • If the record is created with MyField__c <> "MyValue", the workflow will fire.

    • If the record is created with MyField__c = "MyValue", the workflow will not fire.
    • If it is then edited so that MyField__c <> "MyValue", the workflow will fire.

However, if MyField__c is changed from one value that is <> MyValue to a different value that is <> MyValue it will not fire.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .