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
jolly_jonesyjolly_jonesy 

Developing a ChangeOwnerID formula

Hi Everyone

 

I am a relitive newbie to salesforce formula but created a simple formula which I can use to send out a tailored 'lead notification' email to an owner when the lead has been reassigned to someone new:

 

ISCHANGED(OwnerId)

 

HOWEVER, I want to develop this to only action when another criteria is met.. I have know Iidea how to write it!!

 

Requirement.. I have a custom field that denotes which office the lead belongs to:  field name = Sales Office / Distributer 

 

All I would like to do is modify the formula so that is only happens if

 

ISCHANGED(OwnerId) AND the Sales Office / Distributer is equal to 'Office 1' AND/OR 'Office2' AND/OR 'Office3'  etc etc...

 

Can some one help me please ! :)

 

Many Thanks

 

Also PS does anyone know of a good teaching resource that tells you how to write SF formulas?

 

Thanks

 

Steve

 

SporterSporter

What is the field type of Sales Office / Distributer and what is the API name of the field? (i.e. Sales_OfficeDistributer__c )

jolly_jonesyjolly_jonesy

Hi thanks for replying ..

 

yes when I try to add that field it appears

 

Sales_OfficeDistributer__c

 

in the formula editor.

 

thanks

 

 

SporterSporter

Sorry is it a picklist field or just a text field or multi-picklist?

jolly_jonesyjolly_jonesy

Hi,

 

Actually that may be a little complicated, to simplify can we use another custom field 'Region' which is a picklist of countries

 so change from origanal question:

 

ISCHANGED(OwnerId) AND the Region is equal to 'India' AND/OR 'china' AND/OR 'korea'  etc etc...

 

thanks once again

 

 

SporterSporter

If it's a picklist the AND/OR function isn't really appropiate but anyway try to following

 

ISCHANGED(OwnerID) && (ISPICKVAL(Region, "India") || ISPICKVAL(Region, "China") || ISPICKVAL(Region, "Korea"))

 

If you have a lot of other regions the formula will need to be modified as there are limits to the number of characters compiled and used in a formula.

 

I assume this is for a workflow rule but if you need anything else or the above doesn't work let me know.

jolly_jonesyjolly_jonesy

Hi Thats great I'll try that..

 

however the number of countries could grow so I could do something different to make the formula more efficient.. 

 

how could I write:

 

ISCHANGED(OwnerID) FROM EITHER Owner Name 'Paul' or Owner name Ken

 

so the workflow rule would only work if for leads changing from Paul and Ken... that would make it even more simple and with more scope for expansion, thanks for being so tolerant :)

 

 

 

 

SporterSporter

Try this

 

 

ISCHANGED(OwnerID) &&  (PRIORVALUE(OwnerID) = "Insert Ken's UserID here" || PRIORVALUE(OwnerID) = "Insert Paul's UserID here")

 

 

jolly_jonesyjolly_jonesy

Brilliant thanks one last dumb question is UserID normally email, alias, or firstname+lastname or a code?...

 

sorry

SporterSporter

UserID is the 15/18 long character ID , it can be gotten from the address bar when you are on any user detail:

 

For example a user detail page url https://emea.salesforce.com/00520000001Eb8s?noredirect=1 where I have bolded the ID .

 

You can also get it from the dataloader by exporting your user list inlcuding ID.

 

jolly_jonesyjolly_jonesy

Excellent, works perfectly - thanks a heap! :smileyhappy:

SporterSporter

If you can mark the post that was the solution as the solution that would be great =)