+ Start a Discussion
bcallumbcallum 

"save=1" attribute no longer working?

Hello,

 

I've seen a number of posts regarding this issue, but none have been responded to so I'm hoping there might be more information now.

 

The problem is that I have a custom button which allows you to close a case with one click, the button basically sends you to this URL:

 

https://na5.salesforce.com/{!Case.Id}/s?save=1&cas7=Closed

 

This functionality depends on the "save=1" part of the link, which saves the record without having to click on the save button.

 

This is currently working in an older org I have, but not in any new orgs.  What happens if you try to pass "save=1" you get an error saying,

 

"Error: Invalid Data. 
Review all error messages below to correct your data.
The page you submitted was invalid for your session. Please click Save again to confirm your change."

 

Does anyone know if this behavior has changed?  Or even better, a way to do this now that there seems to be issues?

 

Thank you!

Brendan

bcallumbcallum

Nothing out there huh?

NiklasTNiklasT

I have exactly the same problem. Someone to the rescue?

Frederico RodriguesFrederico Rodrigues

Hi, I actually have an interesting case where i was using the save=1 trick on one org - still working fine there - and now when I tried to apply it to another org it does not. So, either Salesforce.com is smart enough to let legacy work and not allow new ones (which would be very difficult to figure out) or I am missing something. I have seen a number of posts saying that it does not work anymore, but I am not so convinced. 

bcallumbcallum

Frederico - I can confirm that it will definitely not work for you in any new Org (created after 2009/2010 timeframe).

 

As for this being something difficult to pull off (ie allowing it for old orgs, stopping it for new), it's really not that complex.  Salesforce tracks all orgs just like you would any object in your own org.  Each org has its own set of permissions/settings which can be enabled disabled.  Does that help clear things up?

 

-Brendan

Frederico RodriguesFrederico Rodrigues

Hi Brendan, 

 

Thanks for the feedback. I won't push Salesforce.com support then for an answer. I appreciate that they have a number of specific permissions / settings that they can tweak, just did not expect this to be one of them and since this is really only a sort for "runtime hack", I was not expecting to see that difference between my old org and the new one. Now, the question is how to workaround that in my standard page. This was to me a simple record type change as a result of clicking a custom link (IF STATEMENT.... HYPERLINK("/" & Id &"/e?RecordType=012D0000000Mw1f&save=1&retURL=/" & Id, "Click here", "_top")),""))

 

Frederico

bcallumbcallum

If you must stick with a standard page - then you can still use Ajax/JS.  Here's an example of a button that changes the owner of the case to the current user:

 

{!REQUIRESCRIPT("/soap/ajax/21.0/connection.js")} 
var caseObj = new sforce.SObject("Case"); 
caseObj.Id = '{!Case.Id}'; 
caseObj.OwnerId = '{!$User.Id}'; 
var result = sforce.connection.update([caseObj]); 
if (result[0].success=='false') { 
alert(result[0].errors.message); 
} else { 
location.reload(true); 
}

 You can tweak this to your object and change the field to record type and set it to a static value or some formula based on your logic.

 

-Brendan

Frederico RodriguesFrederico Rodrigues

Thanks Brendan, however, I wanted this for a custom formula and not a button or link. This is what I had before and which was working fine:

 

IF( RecordTypeId = "012D0000000Mw1f", "Ready!",
IF (RecordTypeId = "012D0000000N1E3",
	IF(NULLVALUE(EO_Number_Of_LineItems__c,0) = 0, 
		"You cannot .....",
		HYPERLINK("/" & Id &"/e?RecordType=012D0000000Mw1f&save=1&retURL=/" & Id, "Click here", "_top")),""))

This is a custom formula field labelled "Proceed", returning text, which will be either an hyperlink "Click Here", or text messages "Ready!" and "You cannot...." depending on the current record type. The behaviour is that if they are in a given opportunity with lineitems, they can "Proceed" and once they "Click here" we flick the record type and the message will then display "Ready!" in front of the "Proceed" label. If not, we display an explanatory message "You cannot proceed....".

 

A button is really not an option. We may have to live with not forcing the save and bring the edit screen, which the users can close by saving or cancelling as appropriate. 

 

From what I have been able to read, your suggestion does not seem to apply easily to formula fields, but I may be missing something. 

 

Frederico.

bcallumbcallum

Frederico - why don't you do this - keep your custom formula but instead of showing a link to the standard page (with the lovely save=1 parameter) create a custom vf page which will receive two URL parameters,

 

A) Case ID

B) Record Type ID

 

The controller for the page would then grab the incoming Case ID and update it with the Record Type ID provided, then return you to the case page.  That way you can keep your standard page layout.

 

Let me know what you think,

Brendan

bcallumbcallum

Actually you should just be able to use the standard case controller for this and that way the Case ID parameter is already taken care of, you would just need to create one for Record Type ID.

OJMOJM

I just recently used "save=1" in a button hack in Jan 12' with a new EE org.

 

It worked fine and the functionality is still working. But when I try to build a test button in my Dev org it does not work. I get the same error:

 

Error: Invalid Data. 
Review all error messages below to correct your data.
The page you submitted was invalid for your session. Please click Save again to confirm your change."

 

Anyone else experiencing this? Could it just be an issue Dev Orgs?

bcallumbcallum

Interesting!  Hmmm - not sure if that really helps though because it still looks like there's absolutely no way to enable that functionality if it doesn't work for your org.  It's not just dev orgs either, regular production orgs have issues too.  So maybe it's not just the date that the org was created, but some other lurking variable, like a patch release for a specific type of feature?  Probably too many variables to ever nail it down though.

 

I would just give up on trying to use it if you get that error and switch to ajax or vf.

joncline-CCGjoncline-CCG

This feature has simply defaulted to disabled rather than enabled. You can submit a support case in the respective org with "Enable AutoSave by URL" and they will provide an advisory reply which you can confirm and they'll turn it to enabled for that org.

MikeyJamJamsMikeyJamJams

Hi everyone, I've been having the same problem. Our customer used this save=1 attribute to automatically close cases without going to the Case Close Layout.

 

I tried replicating this in my Dev sandbox in a custom button but was ending up on the Case Close page layout, getting the same error that my session expired, and I had to click to "Save" again.

 

I just wanted to mentioned that bcallum's javascript method worked for me. Also, thank you for making it easy to follow! I'm an administrator and certainly not an expert by any means with JavaScript, Apex, etc; but, I was able to get the button working your code.

Chirag MehtaChirag Mehta
Salesforce disabled this feature for new orgs created sometime after early 2011. This should have be done to protect from some sort of potential url/cross scripting attacks.

As JONCLINE pointed out, to be able to use it you have to log a case with Salesforce support and ask for that ability to be turned on.
Chirag MehtaChirag Mehta
Got below reply from salesforce :(

Please be informed that this is considered a URL hack and it is not supported by Salesforce. Using undocumented query strings is absolutely discouraged as Salesforce can change them at any time without notice. Instead this requirement can be implemented by using the Force.com AJAX toolkit or a Visualforce page with a custom controller.

For your reference you may visit the article provided below:

https://help.salesforce.com/apex/HTViewSolution?urlname=How-can-I-allow-autosave-by-URL&language=en_US