You need to sign in to do that
Don't have an account?
Need to refresh Salesforce1 VF page
Hello Everyone,
I am new to salesforce1 and having problem while working with VF pages. I have a VF page that saves some records. When i edit any record and updates the value, the value is changed in the database but doesn't reflect on the standard detail page but when i refresh my page then the updated value appeared. I think old value is displaying from the cookies. I am using salesforce1 mobile browser app. Can anyone tell me how can i get the refreshed value?
Thanks in advanced
I am new to salesforce1 and having problem while working with VF pages. I have a VF page that saves some records. When i edit any record and updates the value, the value is changed in the database but doesn't reflect on the standard detail page but when i refresh my page then the updated value appeared. I think old value is displaying from the cookies. I am using salesforce1 mobile browser app. Can anyone tell me how can i get the refreshed value?
Thanks in advanced
See the sample and related discussion in the thread below,
https://developer.salesforce.com/forums/ForumsMain?id=906F00000009E5wIAE
Regards,
Ashish
I think this is not related to Salesforce1 app. I am working on Salesforce1 and i need to use "pull to refresh" to refresh the records. I want it to get the updated records automatically. I am redirecting through javascript library i.e. sforce.one.navigateToSObject(recordId,view) but when it takes me to the detail page of that record, the page shows the old record and i have to refresh it to get the updated record.
Not exactly sure but can you have the pagereference to the OnSave action and see if it redirects to a new page with the list.
Looks like it currently is just doing a 'Go back to the previous page' action.
Regards,
Ashish
I've been doing some development in Salesforce1, and I found the same behaviour that you are facin at the moment when I use VF pages. In my case I have a custom Chatter Action where I update some fields on a record at the same time I have other logic. When the action is finish , it take me back where I specified that is the same record where I started the action , however I expected to see the changes but in order to see them I have to pull for refresh.
However if I don't use custom Chatter Action, if I use a no custom chatter action like update record one , when the action is finished it takes me back to the record and in this case the Record reflects the changes.
I have a case with Salesforce to know why is this behavior. Let you know as soon I have something.
Cheers.
I also tried to submit a case to salesforce about this but couldn't make it. So waiting for your answer. Thanks again. :)
Thanks to you!
My action update some fields on the record. and I close the publisher, it shows me the same rerord with old values.
I still have the case open.
They told me that the issues was the use of JavaScript Remoting. However I tested out without it and still not working.
They are working on it still :(
Let you know at the end of the week how it is going. Also I'll share the test code that I send them , hopefully today.
Cheers,
Carolina.
As I promissed here it is the result in order to update the record :
As per the updates, the navigateto does not work properly. Seems like this is known issue to salesforce and possible it will be fixed in next few releases. ( safe harbor)
Then what to do meanwhile?
Having the same issue and after chatting with Salesforce the solution below is the one that I'm using meanwhile. It works :)
Solution : --------------------------------------------------------------------------
Sfdc.canvas.publisher.publish({name: "publisher.close", payload:{ refresh:"true"}});
Then this could be your page: -------------------------------------------------------
<apex:page showHeader="true" standardController="Account" extensions="AccountController" sidebar="true">
<!-- <script type="text/javascript"> -->
<script type='text/javascript' src='/canvas/sdk/js/publisher.js'/>
<script src="https://mobile1.t.salesforce.com/soap/ajax/30.0/connection.js" type="text/javascript" />
<script>
function myUpdateAccount()
{
var accountId = document.getElementById('accountId').value;
Visualforce.remoting.Manager.invokeAction(
'{!$RemoteAction.AccountController.accountUpdateNumberField}', accountId, function(result, event)
{
<!-- if(result!=null) sforce.one.navigateToSObject(result,"detail"); -->
Sfdc.canvas.publisher.publish({name: "publisher.close", payload:{ refresh:"true"}});
});
}
</script>
<input type="text" name="name" id="accountId" value="{!viewState.accountId}"/>
<a href="#" data-role="button" class="updateNotify" id="sendInvoicesMyself" onclick="myUpdateAccount()">Update Account</a>
</apex:page>
Hope it helps!
Kind Regards,
Carolina.
Custom button with VF page on detail page.
when clicked, executes remote method, updates data and comes back to detail page and refreshes detail page with updated data.
Regards,
Nilesh
Has Anybody found the solution for Nitin Sehgal's senario???
Sfdc.canvas.publisher.publish({name: "publisher.close", payload:{ refresh:"true"}});
Hope it helps.
I am new to Salesforce1. Can you please explain how the '{!$RemoteAction.AccountController.accountUpdateNumberField}' works?
In general, how should the apex controller extensions="AccountController" look like.
Thanks
This seems to work with the save and cancel buttons. Assuming that our pre-lightning save/cancel methods already worked in the controller.
<apex:commandButton id="btnSave" value="Save" action="{!save}" oncomplete="backIfNoErrors(); " immediate="false" reRender="errmsg, errmsgBottom" status="actStatusId" />
<apex:commandButton id="btnCancel" value="Cancel" action="{!cancel}" onclick="back(); " immediate="false" ></apex:commandButton>
<script type="text/javascript">
function back() {
sforce.one.back(false);
}
function backIfNoErrors() {
var errs = jQuery('.messageCell').length;
if (errs == 0){
sforce.one.back(true);
}
}
</script>