• tulikam
  • NEWBIE
  • 0 Points
  • Member since 2010

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 2
    Questions
  • 8
    Replies

I want to check if user is system administrator in visual force page. if not then redirect to another page.

Please help me.

Hello,

when im running the belo code as a system administrator its working fine. But while running the code as a standard platform user its giving me this error. "Id value is not valid for Topic__c standard controller”

Please help me solve this error.

 

my apex class is:

 

public class Topic {

 public Topic(ApexPages.StandardController ctrx)  
 
  { 
         c1=new Topic__c();
         m=new message__c();
        
  
   }
 

The page from which it was redirected:

 

<apex:page StandardController="Topic__c" extensions="Topic" >
<apex:form id="form"  >
<apex:pageBlock >
        <apex:pageBlockSection title="Topics First page"  >
        
             <apex:pageBlockTable value="{!emp}" var="item">

                    <apex:column value="{!item.name}"/>
                    <apex:column value="{!item.description__c}"/>
                    <apex:column headerValue="Action" style="white-space: nowrap">
                        <a href="/apex/post_page?id={!item.id}">Post Message</a>
                    </apex:column>

             </apex:pageBlockTable>
                  
        </apex:pageBlockSection>
    
</apex:pageBlock>
<apex:commandButton action="{!new1}" value="new" >
</apex:commandbutton>

</apex:form>
</apex:page>

 

The page to which it was redirected:-

 

<apex:page standardController="Topic__c" extensions="Topic" >
<apex:form >
   
    <apex:pageBlock >
     
        <apex:pageBlockSection title="New Post Page" columns="1" >
            <apex:outputField value="{!Topic__c.description__c}"/>

            <apex:pageBlockTable value="{!MessageList}" var="item">
                <apex:column value="{!item.text__c}"/>
            </apex:pageBlockTable>
           
            <apex:inputField value="{!m.text__c}"/>
           
            <apex:commandButton value="Save" action="{!save1}"/>
        
        </apex:pageBlockSection>
   
    </apex:pageBlock>


</apex:form>
 
</apex:page>

I want to check if user is system administrator in visual force page. if not then redirect to another page.

Please help me.

Hello,

when im running the belo code as a system administrator its working fine. But while running the code as a standard platform user its giving me this error. "Id value is not valid for Topic__c standard controller”

Please help me solve this error.

 

my apex class is:

 

public class Topic {

 public Topic(ApexPages.StandardController ctrx)  
 
  { 
         c1=new Topic__c();
         m=new message__c();
        
  
   }
 

The page from which it was redirected:

 

<apex:page StandardController="Topic__c" extensions="Topic" >
<apex:form id="form"  >
<apex:pageBlock >
        <apex:pageBlockSection title="Topics First page"  >
        
             <apex:pageBlockTable value="{!emp}" var="item">

                    <apex:column value="{!item.name}"/>
                    <apex:column value="{!item.description__c}"/>
                    <apex:column headerValue="Action" style="white-space: nowrap">
                        <a href="/apex/post_page?id={!item.id}">Post Message</a>
                    </apex:column>

             </apex:pageBlockTable>
                  
        </apex:pageBlockSection>
    
</apex:pageBlock>
<apex:commandButton action="{!new1}" value="new" >
</apex:commandbutton>

</apex:form>
</apex:page>

 

The page to which it was redirected:-

 

<apex:page standardController="Topic__c" extensions="Topic" >
<apex:form >
   
    <apex:pageBlock >
     
        <apex:pageBlockSection title="New Post Page" columns="1" >
            <apex:outputField value="{!Topic__c.description__c}"/>

            <apex:pageBlockTable value="{!MessageList}" var="item">
                <apex:column value="{!item.text__c}"/>
            </apex:pageBlockTable>
           
            <apex:inputField value="{!m.text__c}"/>
           
            <apex:commandButton value="Save" action="{!save1}"/>
        
        </apex:pageBlockSection>
   
    </apex:pageBlock>


</apex:form>
 
</apex:page>