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: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; return NULL; } }
Please help!
Try this
instead use oncomplete
So when your controller logic execution completed after that it will refresh the page.
I tried both ways and neither seemed to work for me. Any other ideas?
Appreciate the help.
Found the answer hidden in the darkest corners of the internet. Here is what finally worked.
Ended up incorporating the below code into my visualforce page
and the below code into the class
Below is the final version.
Visualforce Page
Class
Thanks for all your help!
So the above was working and now its finicky again?
Can anyone help? I feel like I'm so close!!
Use oncomplete instead onclick
I get the following when I try that:
:
= (
How do I incorporate the above solution into my code?
Appreciate any help.
The code you have helped me with so far is not refreshing the related this. How do we incorporate that?