function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Atul GuptaAtul Gupta 

Fetch URL parameter in inline vf page controller

Need to fetch URL parameter in an inline visual force page's controller ??

 

I've tried

 

String CALLID = ApexPages.currentPage().getParameters().get('CALLID');
String CALLIDsystem = System.currentPagereference().getParameters().get('CALLID');

 

I've also tried to fetch the parameter on the page itself :

 

CALLID : <apex:outputText value="{!$CurrentPage.parameters.CALLID}"/>

 

 

none of this is working ?? Any idea guys.....

Best Answer chosen by Admin (Salesforce Developers) 
Atul GuptaAtul Gupta
Sandeep,

Yup yesterday I tried this approach and it worked :)

I used document.referrer and it did the task for me.

Thanks again !!

________________________________
This message is for the designated recipient only and may contain privileged, proprietary, or otherwise confidential information. If you have received it in error, please notify the sender immediately and delete the original. Any other use of the e-mail by you is prohibited.

Where allowed by local law, electronic communications with Accenture and its affiliates, including e-mail and instant messaging (including content), may be scanned by our systems for the purposes of information security and assessment of internal compliance with Accenture policy.

______________________________________________________________________________________

www.accenture.com

All Answers

sandeep@Salesforcesandeep@Salesforce

you can access parameters as 

 

String StringTest = ApexPages.currentPage().getParametes().get('test');

 

IF your URL is some like as below 

https://ap1.salesforce.com/00590000000Yxrl?test=1

 

system.debug('=======testtt====='+Stringtest);

 

and out put would be 

=======testtt=====1

 

 

Atul GuptaAtul Gupta
Hi Sandeep,

Thanks for the reply.

But as you might have from my post, I've already tried this thing, the page where I am doing this is an inline vf page and I'm trying to fetch the parameters in the controller of the inline vf page.

Anybody please reply with a proper solution. Thanks :)

sandeep@Salesforcesandeep@Salesforce

I got your problem.

 

See As you mentioned that you have embedded your page as inline page on standard layout it means you are not getting and parameters in URL itself.  I means your URL should be somehtig like below :-

https://ap1.salesforce.com/XXXXXXXXXXXXXXX so your should get URL and then you need to parse it and get id 'XXXXXXXXXX' from it.

 

String URLText = ApexPages.currentPage().getUrl() ; 

String idText = URLText.subString(URLText.lastindexof('/',URLText.length()) , URLText.length()); 

Atul GuptaAtul Gupta
Sandeep, thanks for the reply...yes I was able to fetch the URL but still there is an issue :

Lets say I'm passing :

https://cs34.salesforce.com/a0WZ0000001r00345?ID=12345&CID=Empl

When I put

String URLText = ApexPages.currentPage().getUrl() ;

In controller's constructor I get:

DEBUG|@@URLText :/apex/vf_page?core.apexpages.devmode.url=1&id= a0WZ0000001r00345&inline=1

How can I get ID and CID ??


Thanks,
Atul Gupta






________________________________
This message is for the designated recipient only and may contain privileged, proprietary, or otherwise confidential information. If you have received it in error, please notify the sender immediately and delete the original. Any other use of the e-mail by you is prohibited.

Where allowed by local law, electronic communications with Accenture and its affiliates, including e-mail and instant messaging (including content), may be scanned by our systems for the purposes of information security and assessment of internal compliance with Accenture policy.

______________________________________________________________________________________

www.accenture.com
sandeep@Salesforcesandeep@Salesforce

I am not sure that if URL is
https://cs34.salesforce.com/a0WZ0000001r00345?ID=12345&CID=Empl and
get URL is returning

DEBUG|@@URLText :/apex/vf_page?core.apexpages.devmode.url=1&id= a0WZ0000001r00345&inline=1

only this also pass CID information please check again

Atul GuptaAtul Gupta
Sandeep,

Yes I've checked again.....its returning

DEBUG|@@URLText :/apex/vf_page?core.apexpages.devmode.url=1&id= a0WZ0000001r00345&inline=1
Only :(

Please be aware that all of this I'm doing is a controller for an inline visual force page. I've embedded the page in the standard contact page layout.

________________________________
This message is for the designated recipient only and may contain privileged, proprietary, or otherwise confidential information. If you have received it in error, please notify the sender immediately and delete the original. Any other use of the e-mail by you is prohibited.

Where allowed by local law, electronic communications with Accenture and its affiliates, including e-mail and instant messaging (including content), may be scanned by our systems for the purposes of information security and assessment of internal compliance with Accenture policy.

______________________________________________________________________________________

www.accenture.com
sandeep@Salesforcesandeep@Salesforce

You can do one more thing that:- 

you can write Java script on inline Page and then in that JS you can fetch URL of parent of current page. Please try and let me know

Atul GuptaAtul Gupta
Sandeep,

Yup yesterday I tried this approach and it worked :)

I used document.referrer and it did the task for me.

Thanks again !!

________________________________
This message is for the designated recipient only and may contain privileged, proprietary, or otherwise confidential information. If you have received it in error, please notify the sender immediately and delete the original. Any other use of the e-mail by you is prohibited.

Where allowed by local law, electronic communications with Accenture and its affiliates, including e-mail and instant messaging (including content), may be scanned by our systems for the purposes of information security and assessment of internal compliance with Accenture policy.

______________________________________________________________________________________

www.accenture.com
This was selected as the best answer
sandeep@Salesforcesandeep@Salesforce

Can you please give me kudos just by clicking STAR icon and mark my comment as answer if these were helpful to you.

srlawr uksrlawr uk

Could one of you please elaborate on the solution before it is marked as answered?

 

I'd be interested in hearing how javascript and/or document.referrer solved this problem :)

 

Cheers.