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
Abc234Abc234 

Getting error while using getparameters

pageReference pr = new pageReference('/apex/Homepage?uid ='+ listusers[0].id);

pr.setredirect(true);

return pr;

when i use above code am getting error

 

LoginController Compile Error: line 37:81 no viable alternative at character '' at line 37 column 81

 

 So i tried with getparameters still am getting run time error

 

PageReference pr= page.Homepage;
pr.getParameters().put('id',listusers[0].id);

pr.setredirect(true);

return pr;

 

Visualforce Error

Id value a099000000AWn0l is not valid for the Movie__c standard controller

 

How to use ID that i passed through getparameters, in Movie page

 

I just need to display like hello Name

 

Can anyone help me in this

PrakashbPrakashb

It looks like Movie__c is the controler for your page, and you are trying to pass the user id as the Id parameter.

 

You need to replace the id  with uid as mentioned below.

 

PageReference pr= page.Homepage;
pr.getParameters().put('uid',listusers[0].id);

pr.setredirect(true);

return pr;

 

For the previous option can you let us know what is your code in line no 37.

 

Abc234Abc234

Thanks prakash for replying me,

 

its working now i have used

pr.getParameters().put('loginid',listusers[0].id);

but i forgotten to use 'currentpage' in redirected page so its giving 2nd error

But i don't know y its giving 1st below is my code for line no 37

 

if(listusers[0].Type_of_User__c == 'Admin USer')
              {

pageReference pr = new pageReference('/apex/Homepage?uid ='+ listusers[0].id);
              pr.setRedirect(true);
              return pr;