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
vijethavijetha 

Apex script unhandled exception by user/organization

Dear All,

 

I have Enterprise Edition , There are Profile and users added...

i have a problem: 1. when I login from username xyz@test.com and password, i will login and perform the tsk and logout.

2. If I login from any other username abc@test.com and password, i get the error :

 

Developer script exception from ABC : controller : List has no rows for assignment to SObject

Apex script unhandled exception by user/organization: 00521111124os5/00D20000000Bdir

Visualforce Page: /apex/page

kindly help !!

 

thanx in advance

Park Walker (TAGL)Park Walker (TAGL)

It would appear that you have a VisualPage which is doing a select using the logged in user as a criteria. The query is not returning any records for the abc.test.com user and the code is not testing to see if any results were returned before using the query result.

 

Look at the code for the page "page".

 

Park

Pradeep_NavatarPradeep_Navatar

Are you able to login through other user names and passwords? or are you getting the error at the time of login itself? There can be several reasons for an example user can be inactive or there may be some profile permisson issues. Can you elaborate your problem a bit more?

crop1645crop1645

Adding ...

 

The Apex code is not written correctly as it assumes that there will always be rows to retrieve.  One useful idiom to follow in the APEX code is this:

 

for (ObjectName x : [select id, foo, bar from Objectname where criteria]) {
   // do stuff with each record -- if no records retrieved, then for loop body wont execute nor error
  }