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
Jennifer.SchnellJennifer.Schnell 

Looking to modify an existing formula field to add additional criteria

We have a custom formula field with the code below and I need to add additional requrement - everything evaluates as is but also if it meets the criteria of the one line of code below  the field value should be 'Project'.

I have been trying to add the below line of code (which I think is correct)  to the existing formula (2nd code), but not getting the results I am expecting.  Does this line of code need to be a seperate part of the formula all together with the value 'Project' ?
(Data1_Services2__c = TRUE) && Owner.UserRole.Name <> "DGA"


 
IF( 
OR( 
AND(ISPICKVAL( ABC_Software_Type__c , 'Term License'), ABC_License_of_Years__c >=12), 
AND(ISPICKVAL( DEF_License_Type__c , 'Term License'), DEF_License__c >=12), 
AND(ISPICKVAL( HIJ_License_Type__c , 'Term License'), HIJ_License_of_Years__c >=12), 
AND(ISPICKVAL( KLM_License_Type__c , 'Term License'), KLM_Term__c >=12), 
AND(ISPICKVAL( OPQ_License_Type__c , 'Term License'), OPQ_License_of_Years__c >=12), 
AND(ISPICKVAL( RST_License_Type__c , 'Term License'), RST_Term__c >=12), 
AND(ISPICKVAL( UVW_License_Type__c , 'Term License'), UVW_License_of_Years__c >=12), 
AND(ISPICKVAL( XYZ_License_Type__c , 'Term License'), XYZ_Term__c >=12), 
AND(Data1_Services1__c = TRUE) 
), 
'Term', 
IF( 
AND( 
OR(ISPICKVAL(ABC_Software_Type__c,""),ISPICKVAL(ABC_Software_Type__c,"--None--")), 
OR(ISPICKVAL(DEF_License_Type__c,""),ISPICKVAL(DEF_License_Type__c,"--None--")), 
OR(ISPICKVAL(HIJ_License_Type__c,""),ISPICKVAL(HIJ_License_Type__c,"--None--")), 
OR(ISPICKVAL(KLM_License_Type__c,""),ISPICKVAL(KLM_License_Type__c,"--None--")), 
OR(ISPICKVAL(OPQ_License_Type__c,""),ISPICKVAL(OPQ_License_Type__c,"--None--")), 
OR(ISPICKVAL(RST_License_Type__c,""),ISPICKVAL(RST_License_Type__c,"--None--")), 
OR(ISPICKVAL(UVW_License_Type__c,""),ISPICKVAL(UVW_License_Type__c,"--None--")), 
OR(ISPICKVAL(XYZ_License_Type__c,""),ISPICKVAL(XYZ_License_Type__c,"--None--")) 
), 
'NA', 
'Project' 
) 
)

 
Alain CabonAlain Cabon

IF( 
    OR( 
    AND(ISPICKVAL( ABC_Software_Type__c , 'Term License'), ABC_License_of_Years__c >=12), 
    AND(ISPICKVAL( DEF_License_Type__c , 'Term License'), DEF_License__c >=12), 
    AND(ISPICKVAL( HIJ_License_Type__c , 'Term License'), HIJ_License_of_Years__c >=12), 
    AND(ISPICKVAL( KLM_License_Type__c , 'Term License'), KLM_Term__c >=12), 
    AND(ISPICKVAL( OPQ_License_Type__c , 'Term License'), OPQ_License_of_Years__c >=12), 
    AND(ISPICKVAL( RST_License_Type__c , 'Term License'), RST_Term__c >=12), 
    AND(ISPICKVAL( UVW_License_Type__c , 'Term License'), UVW_License_of_Years__c >=12), 
    AND(ISPICKVAL( XYZ_License_Type__c , 'Term License'), XYZ_Term__c >=12), 
    AND(Data1_Services1__c = TRUE) 
    ), 
'Term', 
IF( 
    AND( 
    OR(ISPICKVAL(ABC_Software_Type__c,""),ISPICKVAL(ABC_Software_Type__c,"--None--")), 
    OR(ISPICKVAL(DEF_License_Type__c,""),ISPICKVAL(DEF_License_Type__c,"--None--")), 
    OR(ISPICKVAL(HIJ_License_Type__c,""),ISPICKVAL(HIJ_License_Type__c,"--None--")), 
    OR(ISPICKVAL(KLM_License_Type__c,""),ISPICKVAL(KLM_License_Type__c,"--None--")), 
    OR(ISPICKVAL(OPQ_License_Type__c,""),ISPICKVAL(OPQ_License_Type__c,"--None--")), 
    OR(ISPICKVAL(RST_License_Type__c,""),ISPICKVAL(RST_License_Type__c,"--None--")), 
    OR(ISPICKVAL(UVW_License_Type__c,""),ISPICKVAL(UVW_License_Type__c,"--None--")), 
    OR(ISPICKVAL(XYZ_License_Type__c,""),ISPICKVAL(XYZ_License_Type__c,"--None--")) 
    ), 
   'NA', 
   IF ( (Data1_Services2__c = TRUE) && Owner.UserRole.Name <> "DGA",  'Project' , 'NA')
 ) 
)

You can just probably replace 'Project' with your new condition but you need also the alternative value: 'NA'
Alain CabonAlain Cabon
Hi Jennifer,

Create Salesforce Formulas Easier with this Chrome Extension (Free) (very easy installation)
By Ledgeview Partners

Enhances the formula editor textareas ( Kyle Peterson ) to have syntax highlighting, tabbing, parenthesis matching, and find and replace.
Have an issue or a great idea for this extension? Visit the support tab above to leave feedback. When you visit a formula edit page it will automatically enhance the formula textarea with the Edit Area code editor.
  • Editor Features Include:
  • Syntax highlighting
  • Tabbing (tab and shift-tab)
  • Parenthesis matching
  • Find and Replace
  • No code wrapping
  • Resize editor window by clicking bottom right corner
  • Full screen feature
http://ledgeviewpartners.com/blog/easier-salesforce-formulas-with-chrome/

User-added image

"?" about Editerea, Syntax highlight by Christophe Dolivet, French.
Alain CabonAlain Cabon
Better Salesforce formula editor (Free)
proposé par Tailwind ltd

https://chrome.google.com/webstore/detail/better-salesforce-formula/cfjbcfgcaojdoemakjmpeghfahcieigk

This extension Improves Saleforce formula editor
Want a better formula editor for Salesforce?
- With Syntax highlighting
- Field and Metadata autocomplete
- Live snippets & Documentation
- Tabulation support
- lightning compatible - ...

User-added image

User-added image

MichaelModified 13 nov. 2017
Thanks for adding auto parenthesis!!