+ Start a Discussion
Victor19Victor19 

get specific parameter from a url

Hi,

I need to grab only the id from the current page. I am currently using: 
ApexPages.currentPage().geturl();

Is there a way to capture selective parameters from the currentPage url.

I would really appreciate if someone could help me out

Thanks! 
Best Answer chosen by Victor19
KodiKodi
Hi,

You have to get parent record id from the URL,

This is a example for, how to get parent id from url in my custom objects,

klid=ApexPages.currentPage().getParameters().get('CF00N90000008dXrx_lkid');
recklid=ApexPages.currentPage().getParameters().get('CF00N90000008dXrx');

Try this type of way in your parent record id.

All Answers

Venkat PolisettiVenkat Polisetti
Here it is:

ApexPages.currentPage().getParameters().get('id')

Thanks,
Venkat
Victor19Victor19
Hi Venkat,

I already tried the get('id') method and it is returning a null value;

Basically what I am trying to do is I am populating the child record with the parent id in the lookup field by grabbing the parent record id from the url. 

I am doing it through apex and visualforce.
Venkat PolisettiVenkat Polisetti
Please post your code, then we can see how we can help you.

Thanks
KodiKodi
Hi,

You have to get parent record id from the URL,

This is a example for, how to get parent id from url in my custom objects,

klid=ApexPages.currentPage().getParameters().get('CF00N90000008dXrx_lkid');
recklid=ApexPages.currentPage().getParameters().get('CF00N90000008dXrx');

Try this type of way in your parent record id.
This was selected as the best answer
Victor19Victor19
Thanks Kodi! It worked just as expected.