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
SirishaMSirishaM 

Notes and Attachments Problem

Hi,

I have a query regarding the Notes & Attachments.
I want to remove "New Note" button or atleast rename it to something which is relevant to my application. Is this possible ? If not, any ideas of how to implement a button which has the functionality of the "Attachment"  button.

Thanks
Sirisha
ESES
I guess you are trying to change names of the buttons on "Notes and Attachments" related list. On a visualforce page, it is possible to override the header of relatedlists by using the header facet. For example,

Code:
<apex:page standardController="account">
<apex:relatedList list="notesandattachments">
<apex:facet name="header">
<apex:outputPanel>
<apex:outputText value="My Notes"></apex:outputText>
<apex:form>
<apex:commandButton value="A Note" action="URL_OR_ACTION_METHOD"></apex:commandButton>
</apex:form>
</apex:outputPanel>
</apex:facet>
</apex:relatedList>
</apex:page>

 

SirishaMSirishaM
Hi,

Thanks for the reply but I am getting this error

Illegal view ID URL_OR_ACTION_METHOD. The ID must begin with /


Sirisha
SirishaMSirishaM
I dont know exactly what action method shd I use for the new note or attachment. Kindly help if you know.

Sirisha
SirishaMSirishaM
Hi ,

Thanks for the help.. now I cud make it work

Sirisha
SirishaMSirishaM
Hi,

Even though I cud rename the button . After i save the  note or attachment, it is redirecting me to home page. Can anybody help me with that ? Or is there any easy method to rename the button .

Thanks,
Sirisha
ESES
You can use "retURL" parameter to tell the standard page thats creates note/attachment where you want to go after save etc. For pages, you can use $Page to get the url of a visualforce page you want to return to. For example in the example below I want to get back to a page called "MyPage" after the save

na1.salesforce.com/002/e?retURL=/apex/MyPage&parent_id=001D000000IPaJO

Code:
retURL=$Page.MyPage

 
Sorry, I am not aware of any way to change the name of these standard buttons without the use of Visualforce (although this is visualforce form anyway :)).
SirishaMSirishaM
Hi ES,

Thanks for the reply. I wrote a custom extension to a standard controller to navigate thru pages but the following is my problem..

How do I specify the URL of the page where I intend to go ?

PageReference accepts only Page.mypage format but not the Url itself.

This is what I am trying to do..

I click on the "Attach file" button it takes me to a page where I can attach files-- I want this as say middlepage
then I want to go back to original custom object page -- say this as final page. The following is the custom extension and
attach is my custom button which has same functionality as "Attach File".

Code:
public class Attachmentclass {

private final Course__c crs;

public Attachmentclass(ApexPages.StandardController stdController){
this.crs=(Course__c) stdcontroller.getRecord();
}

public PageReference attach() {
PageReference middlepage;
middlePage.getParameters().put('pid',crs.id);
middlePage.getParameters().put('retURL',Page.coursepage);--getting error here
upsert (crs);
PageReference finalPage = Page.coursepage;
finalPage.setRedirect(true);
finalPage.getParameters().put('id',crs.id);
return finalPage;
}

 Also, the middle page should have this URL--https://na5.salesforce.com/p/attach/NoteAttach

The answer might be simple but I am new to this stuff.. any help is greatly appreciated.

Thanks,
Sirisha



Ron HessRon Hess
i think you want something like this.

middlePage.getParameters().put('retURL',Page.coursepage.getUrl() );

jwetzlerjwetzler
Please check out the documentation for PageReference.  It should answer all of the questions you have.
link

I don't understand what your method is attempting to do.  You don't even use middlePage after you set your parameters on it, and you did not give it a page or url.  I'm surprised that it's not throwing a NullPointer when you attempt to set parameters on it, since you haven't initialized middlePage to anything.

Again read the doc for this, I think it should be able to clear up any confusion you have.
SirishaMSirishaM
Hi all,

Thanks for  ur replies !!! With all ur ideas I cud make the code work as wanted..

Sirisha:smileyhappy: