Opportunity Name Workflow Help - Answers - Salesforce Trailblazer Community
Trailblazer Community
Ask Search:
Aimee BAimee B 

Opportunity Name Workflow Help

I have this rule criteria for a workflow to help standardize the opportunity names in my organization:

NOT(CONTAINS( Name, Account.Name )) ||OR(ISNEW(),
ISCHANGED(Amount))

Here is the formula for the field update:
IF( ISNEW(), Account.Name & ": " & Name &"- " & Text (Amount),
LEFT(Name,Find("-", Name)-1)&"-" & Text (Amount) )

The format we want for the opps is: Company Name (from Account) : Opp Name inputted - Amount (from amount field)

My issue is, after the opp has been created, if the sales rep completely deletes the name to enter in a new opp name; the name only saves as the amount - not the format we want.

I've written this rule:
AND( NOT(ISCHANGED(Name)) ,
ISCHANGED(Amount) ,
NOT(CONTAINS( Name, Account.Name ))  ||OR(ISNEW()),
ISCHANGED(Amount))

But this only saves the new name as entered - not in the format we need. 

Can someone help write the rule for any edits to the opp name will have it save in the format we need?
Best Answer chosen by Aimee B
Hemin KaleHemin Kale
Hi Aimee,
I think it was because of missing comma (,) after ISCHANGED.
Try this,
IF( OR(
ISNEW(),
AND(
NOT(ISNEW()),
ISCHANGED(NAME),
NOT(CONTAINS( Name, Account.Name ))
)
), Account.Name & ": " & Name &"- " & Text (Amount),
LEFT(Name,Find("-", Name)-1)&"-" & Text (Amount) 
)

Please do let me know the outcome, I would be happy to help you.

All Answers

Hemin KaleHemin Kale
Hi Aimee,
It feels nice to answer you again on other query!!
I would suggest keep rule/criteria same, Please try this formula for field update:
 
IF( OR(
ISNEW(),
AND(
NOT(ISNEW()),
ISCHANGED(NAME)
NOT(CONTAINS( Name, Account.Name ))
)
), Account.Name & ": " & Name &"- " & Text (Amount),
LEFT(Name,Find("-", Name)-1)&"-" & Text (Amount) )

 
Aimee BAimee B
Hi Hemin,

I'm getting an error for a missing ')'

Where should it be, I think I'm overlooking it.
Hemin KaleHemin Kale
Hi Aimee,
I think it was because of missing comma (,) after ISCHANGED.
Try this,
IF( OR(
ISNEW(),
AND(
NOT(ISNEW()),
ISCHANGED(NAME),
NOT(CONTAINS( Name, Account.Name ))
)
), Account.Name & ": " & Name &"- " & Text (Amount),
LEFT(Name,Find("-", Name)-1)&"-" & Text (Amount) 
)

Please do let me know the outcome, I would be happy to help you.
This was selected as the best answer
Aimee BAimee B
Thank you Hemin, works perfectly!!
Hemin KaleHemin Kale
Have a good day, Aimee