You need to sign in to do that
Don't have an account?
including an if statement to the page action
Hi All,
On my custom "add opportunity product" VFpage I currentyl call a method in my custom controller (priceBookCheck) in the page action.
This works fine but I now need to add an if statment to the page action to ensure that the system administrator can only run the new VF page.
The following works:-
action="{!if(($Profile.Name == 'System Administrator'),
null,
urlFor($Action.OpportunityLineItem.AddProduct, Opportunity.Id,
null, true))}">
But I need to call the priceBookCheck method when the if statement is true. I have tried the following but get a syntax error
action="{!if(($Profile.Name == 'System Administrator'),
{!priceBookCheck},
urlFor($Action.OpportunityLineItem.AddProduct, Opportunity.Id,
null, true))}">
Does anyone know how to accompkish my goal?
Thanks
Hi,
You can check this condition in apex class by calling a action.Like
Get the User profile name using Query
If(UserProfileName = 'System Administrator')
{
// Do this
}
else
{
//Do this
}
Dis this answer help you.If not then let me know the Issue.
Hi,
An infinite loop occurs if I do that as my “else” clause will redirect to the standard opp product screen which is overridden by this VF page.
Hope that makes sense
Hi,
Try the nooverride=false in URL in else condition.
So this will not call your VF Page again.
Like
https://ap1.salesforce.com/001/o?nooverride=false
Hope this wil help you.