You need to sign in to do that
Don't have an account?
Tatiana Cooke 9
Code for refreshing a visual force page to the parent object upon hitting save.
Code for refreshing a visual force page to the parent object upon hitting save. I created a visualforce page that attaches documents in the notes and attachement section, however it doesn't ALWAYS work.
Sometimes when I hit save it does refresh the parent record and show me the attached document in the notes and attachement section and sometimes I have to manually refresh the page to see the recod.
Can someone help me with the below code?
Visualforce Page
class
Please help!
Sometimes when I hit save it does refresh the parent record and show me the attached document in the notes and attachement section and sometimes I have to manually refresh the page to see the recod.
Can someone help me with the below code?
Visualforce Page
<apex:page standardController="Tenant_Coordination__c" extensions="attachmentsample"> <apex:form > <apex:inputfile value="{!myfile.body}" filename="{!myfile.Name}" /> <apex:commandbutton value="Save" action="{!Save}" onclick="window.top.location='/{!Tenant_Coordination__c.id}'; return true"/> <apex:actionFunction name="reloadparent" action="{!reload}" /> </apex:form> </apex:page>
class
public class attachmentsample { public attachmentsample(ApexPages.StandardController controller) { } Public Attachment myfile; Public Attachment getmyfile() { myfile = new Attachment(); return myfile; } Public Pagereference Save() { String accid = System.currentPagereference().getParameters().get('id'); Attachment a = new Attachment(parentId = accid, name=myfile.name, body = myfile.body); /* insert the attachment */ insert a; PageReference parentPage = new PageReference('/' + accid); parentPage.setRedirect(true); return parentPage; } public void reload(){ } }
Please help!
I am trying to relaod the Notes and Attachments section so it will need to refresh the parent page and any related lists.
The above does not work. I think onclick or on complete must be in there.
Appreciate any help!
https://developer.salesforce.com/forums/?id=906F000000096osIAA
https://developer.salesforce.com/forums/ForumsMain?id=906F0000000D83SIAS
Replace child page
<apex:page standardController="Tenant_Coordination__c" extensions="attachmentsample">
<script>
function callParent(){
var winMain=window.opener; if (null==winMain){
winMain=window.parent.opener; }
winMain.closePopup();
}
</script>
<apex:form >
<apex:inputfile value="{!myfile.body}" filename="{!myfile.Name}" />
<apex:commandbutton value="Save" action="{!Save}" oncomplete="javascript:callParent();return false;" />
</apex:form>
</apex:page>
I have a custom object for which I have made visualforce buttons that add attachments to the notes and attachments section.
Is there a way to use it in my code?