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
HayaHaya 

How to update standard pages

I am working on a Customer Portal which has a 5 standard pages and a few custom pages.

When I list the pages in Develop -> Pages I only see the custom pages.

How do I get to the standard pages so I can edit them?

 

bob_buzzardbob_buzzard

It does depend a little on which pages you are talking about, but the most likely way is via the page layout editor, using the layouts available for the particular sobject.  You'll probably need to clone the layouts specifically for the customer portal, and then assign those layouts to the customer portal profile.

HayaHaya

 I need to remove the Status field from Case pages in a Customer Portal.

 

I read that the Status field is a mandatory field so it cannot be removed or hidden from a page layout. I also read that you can create a Visual Force page that you can customize. How do I go about cloning standard Case page layouts to create a Case Visual pages that would keep all the functionality of the original pages?

Achilles21Achilles21

As Status is the mandatory field, I dont think you are allowed to hide it using Page Layouts or Field Level security.

However, I fancy a possibility where you can create a new VF Page and mock all the fields of Case object but Status.
 You can use extension for this.

HayaHaya

I realize that Status is a mandatory field, so I want to know how to go about cloning a standard Case page.

I am very new to VF, and I would very much appreciate if you could explain what "mock all the fields of Case object but Status" means.

 

Thank you,

Haya

Achilles21Achilles21

One way is you create a VF page and mock the fields. You can skip the Status field on the page. What I mean is :

 

<apex:page standardController="Case" extensions="CaseExtension" >
<apex:sectionHeader title="My Cases" subtitle="Here's How your Page will Look Like"/>
   <apex:form >
      <b>Subject</b> <apex:inputField value="{!cs.Subject}" />
    </apex:form>
    
 </apex:page>

 

public class CaseExtension{ 

    Case cs;
    
    public CaseExtension(ApexPages.StandardController controller) 
    {
       
    }
    
    public Case getCS()
    {
        return cs;
    }
}

 One thing still holds true and that is Status is a mandatory field. Your user should not be able to see the field once you use a page but yes you need to give the field some value when you save the record. I mean NEW CLOSE anything like that. use  a (after insert,after update) trigger or a workflow.

 

HayaHaya

Thanks, Achilles.

 

I did some more research and came up with the following code:

 

<apex:page standardController="Case" extensions="CaseExtension">
<apex:pageBlockSection title="Viewed Cases">
<apex:dataTable value="{!case}" var="String" columns="5">
    <apex:column value="{! case.CaseNumber}" /></apex:column>
    <apex:column value="{! case.Contact}" /></apex:column>
    <apex:column value="{! case.Reason}" /></apex:column>
    <apex:column value="{! case.CreatedDate}" /></apex:column>
    <apex:column value="{! case.Owner}" /></apex:column>
</apex:dataTable>
</apex:pageBlockSection>
</apex:page>

 

I keep getting the error msg:

Error: Viewed_Cases line 3, column 46: The element type "apex:datatable" must be terminated by the matching end-tag "</apex:datatable>"

 

I don't see what I am doing wrong. Can you please help me.

 

Also, once I get the code corrected I would like to add an IF statement, such as IF Status eq 'new'.

How would i go about adding that?

 

Thanks,

Haya

 

bob_buzzardbob_buzzard

In your columns:

 

<apex:column value="{! case.CaseNumber}" /></apex:column>

 you are double closing the tag - once with a closing '/>' and then with a full close tag.  You should reduce this to:

 

<apex:column value="{! case.CaseNumber}" />

 

 

 

HayaHaya

That did the trick, thank you so much.

 

My next issue is how to pass a variable to an IF statement

such as IF Status eq '&var' or IF Owner eq  '&var'

 

Regards,

Haya

 

Achilles21Achilles21

It looks stright forward to me. Can you expalin a little more about this issue?

 

Also, you have passed String to var attribute of dataTable which is not appropriate I would say.

Pass something like a char;say S. and you can iterate over the elements of the dataTable using this var.

 

<apex:dataTable value="{!case}" var="S" columns="5">
    <apex:column value="{! s.CaseNumber}" ></apex:column>

 

bob_buzzardbob_buzzard

You can just use merge syntax, something like:

 

rendered="{! IF (case.Status=='Closed', true, false)}"

 

this will render an element if the status is closed, otherwise hide it.

HayaHaya

Thank you for the input, I incorporated your suggestions.

 

What I am trying to accomplish is to replace one of the standard pages in a customer portal. I need to show cases without the status field.

 

This is as far as I got:

<apex:page standardController="Case" extensions="CaseExtension" >
<apex:pageBlock title="Viewed Cases" >
<apex:dataTable value="{!case}" var="s" columns="5" cellspacing="15" >
<apex:column value="{! s.CaseNumber}" headerValue="Case Number" />
<apex:column value="{! s.Contact}" headerValue="Contact Name" />
<apex:column value="{! s.Reason}" headerValue="Reason" />
<apex:column value="{! s.CreatedDate}" headerValue="Created Date" />
<apex:column value="{! s.Owner}" headerValue="Owner" 
</apex:dataTable>
</apex:pageBlock>
</apex:page>

 

I don't know where to add the rendered statement. I would like the page to display cases whose Status is New.

 

 

Achilles21Achilles21

You can add it in  <apex:pageblockTable> tag.

 

HayaHaya

I really appreciate all the help I am getting here.

 

I still have a problem.

 

When I go to the Customer Portal and click on the Tab I created for the Visual page, I get a page with the column headings but no data. Am I supposed to define or allocate the database for use with the page?

 

Regards,

Haya

HayaHaya

Can someone please help me.

I am searching through documentations for an answer and I can't find  why I can't view the data. The standard pages on the portal display the data so I don't think its a security issue.

I checked on the field accessibility and the ones I need are checked.

What am I missing?

 

 

bob_buzzardbob_buzzard

Can you post your latest code?  I have a thought on this but would need to see the code to give context to the explanation.

HayaHaya

Here is my code:

 

<apex:page standardController="Case" extensions="CaseExtension" >
<apex:pageBlock title="Viewed Cases" >

<apex:dataTable value="{!case}" var="s" columns="5" cellspacing="15" >
<apex:column value="{! s.CaseNumber}" headerValue="Case Number" />
<apex:column value="{! s.Contact}" headerValue="Contact Name" />
<apex:column value="{! s.Reason}" headerValue="Reason" />
<apex:column value="{! s.CreatedDate}" headerValue="Created Date" />
<apex:column value="{! s.Owner}" headerValue="Owner" />
</apex:dataTable>
</apex:pageBlock>

</apex:page>

bob_buzzardbob_buzzard

How are you accessing this page?  As you are simply using the standard controller, this will return a single case if you pass a parameter with the id of the case, something like:

 

https://na13.salesforce.com/apex/CustomCasePage?id=<case id>

 

 

HayaHaya

I was playing with the rendered clause. But at this point I would like to show all the cases and later use the Status field to determine what's on the page

HayaHaya

do i have to place the url in my code?

bob_buzzardbob_buzzard

If you want to show all cases, you'd need to query those back in your extension controller, or use a standard list controller.  However, a standard list controller wont give you that much control over the records that are returned.

HayaHaya

Thank you for all your help.

Now I need to learn how to create a extension controller.

Back to the drawing board :)

 

HayaHaya

I was called away on another project, but I am back now working on the customer portal.

I do not know how to create an extension controller. I am browsing though documents but I can't figure it out. Can someone please point me to a tutorial or a document that shows the necessary steps?

 

Thanks,

Haya

Achilles21Achilles21

Haya,

 

The doc Bob has shared has some great examples...you can also check one of the replies I had posted to your question ! That shows Controller Extension for your specific req.

HayaHaya

I am sorry but I still do not know how to pull the data from the database.

 

I am probably missing something very basic.

 

I created the VF page but I don't know how to code the case extension.