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

Display a custom page layout from within a visualforce page depending on profile

I have a small VF page which I want to use to override the Edit button on a custom (managed package) object with a message rather than an edit page. However, if the user logged in has a particular profile, I want the action to continue and to display a custom page layout in edit mode. The folloiwng code displays the message fine for a non Custom System Administrator but otherwisde it displays an edit page that looks a standard (default) one rather than the page layout I want.

I feel like it should juts be something small to achieve this but I cannot get to it.

<apex:page standardController="SVMXC__Service_Order_Line__c" action="{!if($Profile.Name <> 'Custom System Administrator', Null, urlFor($Action.SVMXC__Service_Order_Line__c.Edit, 
$ObjectType.SVMXC__Service_Order_Line__c, null, true))}">
  This link is disabled. Work Details may only be changed via SFM. Select the Line Number to view the Work Detail.
NagendraNagendra (Salesforce Developers) 

Please check with below link from the forums community with a similar issue and suggested workarouund. Hope this will help you to resolve the issue.