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
sudhirn@merunetworks.comsudhirn@merunetworks.com 

Formula specific profile can change the stage.

Hi, 

 I wrote a below formula on stage when stage is set to 8c or 8b it cannot be changed I want to add additional condition only specific profile should be able to change the stage 

 $User.ProfileId = '00e50000000pn5v',
$User.ProfileId = '00e50000000pn5q'  

Please suggest me how to add profile condition to below formuals only they can change no one else should be able to change once this is set 
NOT(
AND(
ISCHANGED(StageName),
OR(
ISPICKVAL(StageName, "8c - Won"),
ISPICKVAL(StageName, "8b - PO Received")
)
)
)

 
Best Answer chosen by sudhirn@merunetworks.com
Dhanya NDhanya N
Please check this formula:
 
AND( ISCHANGED( StageName ) , 
OR( 
ISPICKVAL(PRIORVALUE(StageName ), "8c - Won"), 
ISPICKVAL(PRIORVALUE(StageName ), "8b - PO Recevied") 
), 
$User.ProfileId <> 'sys admin id' 
)

 

All Answers

Dhanya NDhanya N
Hi Sudhim,

Please check below formula:
 
NOT(
	AND(
		ISCHANGED(StageName),
		OR( 
			$User.ProfileId = '00e50000000pn5v',
			$User.ProfileId = '00e50000000pn5q'  
		),
		OR(
			ISPICKVAL(StageName, "8c - Won"),
			ISPICKVAL(StageName, "8b - PO Received")
		)
	)
)

Thanks,
Dhanya
sudhirn@merunetworks.comsudhirn@merunetworks.com
Thanks for your reply Dhanya you code is working in some case its not may be something wrong with my logic 

  My requirement is if the stage set to stage  =  8c - Won or stage = 8b - PO Received only admin can change back to any other stage if other profiles try to change it must through validation message 

 Please suggest me how to tweek this logic 

Thanks in advance

Thanks
Sudhir

 
sudhirn@merunetworks.comsudhirn@merunetworks.com
Hi, 

 With the formula below i can only set to 8c - Won or 8b - PO Received I am not able to change to any other stage even if i login with below profiles. 
NOT(
	AND(
		ISCHANGED(StageName),
		OR( 
			$User.ProfileId = '00e50000000pn5v',
			$User.ProfileId = '00e50000000pn5q'  
		),
		OR(
			ISPICKVAL(StageName, "8c - Won"),
			ISPICKVAL(StageName, "8b - PO Received")
		)
	)
)

Thanks
Sudhir
Dhanya NDhanya N
Please check this formula:
 
AND( ISCHANGED( StageName ) , 
OR( 
ISPICKVAL(PRIORVALUE(StageName ), "8c - Won"), 
ISPICKVAL(PRIORVALUE(StageName ), "8b - PO Recevied") 
), 
$User.ProfileId <> 'sys admin id' 
)

 
This was selected as the best answer
sudhirn@merunetworks.comsudhirn@merunetworks.com
Wonder full this worked as expected Thank You Dhanya only modification i made is added two profiles in the condition 
 
AND( ISCHANGED( StageName ) , 
OR( 
ISPICKVAL(PRIORVALUE(StageName ), "8c - Won"), 
ISPICKVAL(PRIORVALUE(StageName ), "8b - PO Recevied") 
), 
$User.ProfileId <> '00e50000000pn5v',
$User.ProfileId <> '00e50000000pn5q' 
)