You need to sign in to do that
Don't have an account?
sfdcraj
test case....how to pass userinfo to trigger from test class
Hi,
I am writing a test class for this trigger.
Query in Trigger:
List<PermissionSetAssignment> list1= [select id from PermissionSetAssignment WHERE PermissionSetId IN(select id from permissionSet where label='A') AND AssigneeId=:Userinfo.getUserId()];
Now how to pass the user ID in session info to trigger so that this query returns the rows.
I am creating my test user who is assigned to permission set 'A' in my test class. I just need to pass this user id in session info so that when trigger executes and the list is not empty.
Can any one help me?
Regards,
raj
I am writing a test class for this trigger.
Query in Trigger:
List<PermissionSetAssignment> list1= [select id from PermissionSetAssignment WHERE PermissionSetId IN(select id from permissionSet where label='A') AND AssigneeId=:Userinfo.getUserId()];
Now how to pass the user ID in session info to trigger so that this query returns the rows.
I am creating my test user who is assigned to permission set 'A' in my test class. I just need to pass this user id in session info so that when trigger executes and the list is not empty.
Can any one help me?
Regards,
raj
Please refer to below section. You will idea.
http://www.salesforce.com/us/developer/docs/apexcode/Content/apex_testing_tools_runas.htm
All Answers
Please refer to below section. You will idea.
http://www.salesforce.com/us/developer/docs/apexcode/Content/apex_testing_tools_runas.htm
Sorry for the delay!!
Your reply was right on spot. Thanks for the help!!
Regards,
raj