+ Start a Discussion
ChermaduraiChermadurai 

Reg: RunAs

Hello..

 

Is there any update for System.RunAs in Summer 13.

 

My testcase runs successful in Sandbox. but getting error in Production..

 

System.TypeException:System.RunAs can only be used with an active user

Devendra@SFDCDevendra@SFDC
Hi,

At the time of query for an User which you are using for runAs returning an Inactive user.

Try to add one more filter while querying for an User which is IsActive =: true

This will return a active user.

Thanks,
Devendra
SRKSRK
Devendra is rite you need to fatch a active user

i will be much batter if you create user with in the test method
that what salesforce suggest in this kind of casses