+ Start a Discussion
jenny jadejenny jade 

Help needed for writing a formula

I need to show different messages depending on the discount % on Quote obj
I have two fields Dis% and Message
Dis%0 to 5 then Message should be Auto Approved
Dis%5 to 10 then Message should be Auto Approved
Dis%10+ then Message should be Need SVP Approval
and adding tho this we need to show Message as Auto Approved if Directors or sys admins are creating a quote no matter what the dis% is

 
sukanya banekarsukanya banekar
Hi Jenny,
You can write formula for this as below
 
IF((ProfileId=='directors profile id' || ProfileId=='systemAdmin profile') || (discount >= 0 and discount <= 10),Auto Approved, IF(discount >10,Need SVP Approval, NULL) )

I hope this will help you.

Thanks,
Sukanya

 
Saravanan Sivalingam 1Saravanan Sivalingam 1
Hi Jenny
IF($Profile=='Directors' || $ProfileId=='systemAdmin') || discount__c =0 || discount__=5), Auto Approved,  Need SVP Approval)

make this best ans if this sloved your task.

Thanks,
Saravanan Sivalignam.
 
jenny jadejenny jade
Any help tweaking this formula
all I want to acheive is
Dis%0 to 5 then Message should be   Auto Approved
Dis%5 to 10 then Message should be Director Approval
Dis%10+ then Message should be      Need SVP Approval


IF( 
OR(AND(AverageCustomerDiscount__c<=0.1,$UserRole.Name ='Director',$UserRole.Name ='Sales Director',$UserRole.Name ='Agency Director',$UserRole.Name ='Specialist'),AverageCustomerDiscount__c<=0.05,$User.Alias='Mat',$User.Alias='hoe',"Auto Approved"),IF(AND(AverageCustomerDiscount__c>=5 ,AverageCustomerDiscount__c<=10),"Director Approval Required","SVP Approval"))

I am getting this below error
 Error: Incorrect parameter type for function 'OR()'. Expected Boolean, received Text
Saravanan Sivalingam 1Saravanan Sivalingam 1
Choose Datatype: formula and return type Text

IF( 
OR(AverageCustomerDiscount__c<=5,$UserRole.Name ='Director',$UserRole.Name ='Sales Director',$UserRole.Name ='Agency Director',$UserRole.Name ='Specialist'), Auto Approved, IF( verageCustomerDiscount__c<=10, Director Approval, AverageCustomerDiscount__c>10,Need SVP Approval)))

If still not your task sloved , please let me know, what exactly u want. 

Actully u mentioned that Dis%0 to 5, but u used like AverageCustomerDiscount__c<=0.1,AverageCustomerDiscount__c<=0.05,, alos u not clearly mentined the users that u want in formula.

Dis%0 to 5 then Message should be   Auto Approved
Dis%5 to 10 then Message should be Director Approval
Dis%10+ then Message should be      Need SVP Approval


IF( 
OR(AND(AverageCustomerDiscount__c<=0.1,$UserRole.Name ='Director',$UserRole.Name ='Sales Director',$UserRole.Name ='Agency Director',$UserRole.Name ='Specialist'),AverageCustomerDiscount__c<=0.05,$User.Alias='Mat',$User.Alias='hoe',"Auto Approved"),IF(AND(AverageCustomerDiscount__c>=5 ,AverageCustomerDiscount__c<=10),"Director Approval Required","SVP Approval"))


thanks

Saravanan Sivalingam.
jenny jadejenny jade
Apologise for posting incomplete and incorrect question

my scenario is the message field (formula field) should show diffrenet messages depending on the % amount and the role and the user who is creating the record
if AverageCustomerDiscount__c is <= 10% and the the role equals 'Director','Sales Director',Agency Director','Specialist' or if the userid ='Mat' or 'Hoe' it should show as Autoapproved
if AverageCustomerDiscount__c>=5% and AverageCustomerDiscount__c<=10% the message should be as Director Approval and for everything not following the above it should show as SVP Approval.
Saravanan Sivalingam 1Saravanan Sivalingam 1

Hi your questions is wrong....please check your question onece again.. I mentioned that where you need to check this questions in below

there one of the following should be AverageCustomerDiscount__c is >= 10% , but here both condtions were mentioned that AverageCustomerDiscount__c is <= 10%, hows its possible..
 


if AverageCustomerDiscount__c is <= 10% and the the role equals 'Director','Sales Director',Agency Director','Specialist' or if the userid ='Mat' or 'Hoe' it should show as Autoapproved
if AverageCustomerDiscount__c>=5% and AverageCustomerDiscount__c<=10% the message should be as Director Approval and for everything not following the above it should show as SVP Approval.