You need to sign in to do that
Don't have an account?
We have developed hybrid IOS mobile app but facing loading issue if phone is idle for some time, ex: search for account , create new account etc? We have written javascript remote action to fetch the results. I din't find any debug log in system
Hi All,
We have developed IOS mobile app but facing loading issue if phone is idel for some time. The app is working once logout from apps and re login into app.
ex: we are facing issue when search for account, new account creation etc.
We have used javascript remote action to fetch the results .
please see sample code
@RemoteAction
global static List<Account> fetchAccountDetails(String name) {
//system.assertEquals('fd','jk');
// where Name LIKE \'%\''+name+'\'%\'
String qry = 'Select Id,Name,BillingStreet,BillingCity,BillingCountry,BillingState,BillingPostalCode,FloraMobileApp__LGA_Name__c,FloraMobileApp__Stage__c,FloraMobileApp__Total_Order_Arrangements__c,FloraMobileApp__Trial_Arrangements__c,Industry,(Select Salutation,Name,Phone From Account.Contacts) From Account where Name LIKE \'%'+name+'%\' LIMIT 10 ';
return database.query(qry);
}
Please help me.
Regards
Siva.
We have developed IOS mobile app but facing loading issue if phone is idel for some time. The app is working once logout from apps and re login into app.
ex: we are facing issue when search for account, new account creation etc.
We have used javascript remote action to fetch the results .
please see sample code
@RemoteAction
global static List<Account> fetchAccountDetails(String name) {
//system.assertEquals('fd','jk');
// where Name LIKE \'%\''+name+'\'%\'
String qry = 'Select Id,Name,BillingStreet,BillingCity,BillingCountry,BillingState,BillingPostalCode,FloraMobileApp__LGA_Name__c,FloraMobileApp__Stage__c,FloraMobileApp__Total_Order_Arrangements__c,FloraMobileApp__Trial_Arrangements__c,Industry,(Select Salutation,Name,Phone From Account.Contacts) From Account where Name LIKE \'%'+name+'%\' LIMIT 10 ';
return database.query(qry);
}
Please help me.
Regards
Siva.
https://developer.salesforce.com/docs/atlas.en-us.186.0.salesforce_platform_mobile_services.meta/salesforce_platform_mobile_services/hybrid_managing_sessions.htm
scroll down to the JavaScript Remoting in Visualforce section and that shows how to trap an expired session and refresh it.
All Answers
https://developer.salesforce.com/docs/atlas.en-us.186.0.salesforce_platform_mobile_services.meta/salesforce_platform_mobile_services/hybrid_managing_sessions.htm
scroll down to the JavaScript Remoting in Visualforce section and that shows how to trap an expired session and refresh it.
Thanks for you reply.
I tried to reload the page using window.location.reload(), it is working fine.
I am trying to increase performance using other snippet code in mobile sdk pdf but i am not clear couple places.
// Refresh oauth token
cordova.require("salesforce/plugin/oauth").authenticate(
function(creds) {
// Reload hidden iframe that points to a blank page to
// to refresh Visualforce domain cookies
var iframe = document.getElementById("blankIframeId");
iframe.src = src;
// Refresh CSRF cookie
<provider>.refresh(function() {
<Retry call for a seamless user experience>;
});
},
function(error) {
console.log("Refresh failed");
}
);
can you please explain, what is <provider> here? i read below lines in some blog , is it true to required case to enable CSRF?
I logged a case for this as I was able to perform CSRF hacks against methods annotated with @RemoteAction and the response is:
This is not enabled by default. You have to contact salesforce to get CSRF protection for Remote Actions turned on.
Can you please give small example for above code?
Thanks & Regards
Siva.
I found an old github post... and it seems to point to using one of the providers returned by this;
In saying that, I tried to log this out (using JSON.stringify) and it has circular relationships so I actually went with the following and am having some success with it;
I'm still unable to find any absolute documentaion on this, and sadly I also can't find an un-uglified vfremote.js so it's hard to reverse engineer too.