Whenever I enable Require CSRF protection on GET requests
checkbox,it always display the below message:
The link you followed isn’t valid. This page requires a CSRF confirmation token. Report this error to your Salesforce administrator.
I have gone through Couple of Links and Trailhead to understand the purpose of CSRF and how to avoid it.
Cross-Site Request Forgery (CSRF)
Prevent Cross-Site Request Forgery (CSRF) Tralhead Module
But I want to understand the purpose of enabling this checkbox as currently it breaks the link between existing VF page.
If I enable this checkbox, do I need to modify the code in existing VF page?
If yes, what codes needs to be added.
How Can I see existing VF page by enabling this checkbox?
Functionality which is not working in VF Page:
function uncheckCheckboxButton(){
var aId='{!Opportunity.Id}';
if( (typeof sforce != 'undefined') && sforce && (!!sforce.one) ) {
// Salesforce1 navigation
assignTabName();
sforce.one.navigateToSObject(aId);
}
else {
// Set the window's parent URL using a Visualforce expression
assignTabName();
window.top.location.href = '/{!Opportunity.Id}';
// window.location.reload();
// window.parent.location = document.referrer;
}
}
<apex:actionFunction action="{!checkboxFalse}" name="assignTabName" reRender="none">
<apex:param name="oppName" value="{!Opportunity.Id}" />
</apex:actionFunction>
In this VF page,I am unchecking the checkbox value to false.so whenever I click on VF page button,it uncheck the checkbox.
When I enable CSRF protection for this VF page,in else part of VF page,it does not perform an operation in 1st attempt.I need to refresh it again in order to see the correct result. Do I need to add action function in else part?
How can I pass Opportunity Id here?
Also in IF part is there any modification needed as this is For SF1?