function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
JJJenkinsJJJenkins 

Workflow Rule Question - # of times transferred?

I've created a workflow rule that updates everytime the owner is changed.  The field update is the field (# of times transferred) so the formula I've used is #_of_time_Transferred__c +1 so that everytime this workflow fires this field updates.  But it is not working?  Is this possible with workflow or do I need to do it with a trigger?

 

Thanksm

Best Answer chosen by Admin (Salesforce Developers) 
JJJenkinsJJJenkins

In the workflow rule it allows me to use ISCHANGED(OwnerID).  It wasn't updating because there was no value in the field but if I set the default value to 0 it works with the following formula field update attached to the workflow:

 

Of_times_Transferred+1

All Answers

TrimbleAgTrimbleAg

What is the workflow formula you used?

 

Thanks,

PB

JJJenkinsJJJenkins

ISCHANGED(OwnerId)

Shashikant SharmaShashikant Sharma

You can not do this with workflow you need a trigger for this

 

in a workflow rule formula you need this

(OwnerId   <>  PRIORVALUE(OwnerId) )

 PRIORVALUE function is not allowed in workflow rules.

 

So here is your trigger

trigger owenrChangeCount on Account (before update) 
{
      for (Account acc : Trigger.new) 
      { 
         if (acc.OwnerId != Trigger.oldMap.get(acc.Id).OwnerId) 
         {
            if(acc.#_of_time_Transferred__c == null)
                acc.#_of_time_Transferred__c = 1;
            else
                acc. #_of_time_Transferred__c =  acc.#_of_time_Transferred__c + 1;
         }
      }
}

 

 

Let me know if any issue in it.

 

Shashikant SharmaShashikant Sharma

You will not able to save formula :  Function ISCHANGED may not be used in this type of formula. So you have use the trigger that I provided

TrimbleAgTrimbleAg

 

Here is the formula you need to use for the field update:

 

PRIORVALUE(IS_Changed_number__c)+1

 

Have Fun!

 

PB

Shashikant SharmaShashikant Sharma

TrimbleAg,

 

Your formula is for the field update but the main question was to make the formula which will tell OwnerId has been update. How can we check that in Formula Rule. So workflow rule can not be written as privalue and isChanged both can not be used so trigger is the only option.

TrimbleAgTrimbleAg

Actually his first formula for the workflow worked, I've tested the whole problem in my sandbox, what can I say, its a slow day....

 

Thanks,

PB

JJJenkinsJJJenkins

In the workflow rule it allows me to use ISCHANGED(OwnerID).  It wasn't updating because there was no value in the field but if I set the default value to 0 it works with the following formula field update attached to the workflow:

 

Of_times_Transferred+1

This was selected as the best answer
JJJenkinsJJJenkins

Thanks everyone for the help!

Shashikant SharmaShashikant Sharma

TrimbleAg,

 

Yes it got saved now I missed to change the radio option correctly.

Thanks for updating otherwise I might have built wrong concept.

Ankit AroraAnkit Arora

Keen to know the solution.

 

 

Thanks

Ankit Arora

Blog | Facebook | Blog Page