You need to sign in to do that
Don't have an account?
Miraloma
Conditional Redirect
I have a custom link that requires a condition. The content source is set to URL and I want to display a Visual Force page when the condition fails. I have the following syntax.
/{!if(isBlank(Svc_GC__c)
,"apex/NoSvcGCFound"
,Svc_GC__c)
}
The problem is the / in "apex/NoSvcGCFound" gets decoded to %2F and I get a page not foundn error. I've tried to htmlencode, urlencode, ', ", \, //, etc. Nothing worked.
Suggestions are appreciated!
Update:
I ended up changing it to onClick Javascript (instead of URL) and doing the following:
var gc="{!CR__c.Svc_GC__c}";
if (!gc) window.open("/apex/NoServiceGoverningContract");
else window.location.href="/"+gc;
Am still interested in knowing how to do the same in URL if at all possible. Thanks!
Well there seems to be a problem in your code. Apex generally doesnt encode URL automatically.
I tried replicating your scenario by doing some thing like this :
The above code worked as expected
aiming/hoping that it could be done with just the {} escapes.
Thanks!