You need to sign in to do that
Don't have an account?
sreenivasApps
need test class for following trigger ?
have to create new user with required information . so while creating how to give user profileId , user licenseId all those things ...
trigger opprolechangeusertrig on User (after update) {
user u = trigger.new[0];
user u2 = trigger.old[0];
list<Id> lst = new list<Id>();
if(u2.UserRoleId!= u.UserRoleId)
{
lst.add(u.Id);
userrolechangetrigcls.usercls(lst);
}
}
Hi
try like this
@isTest
private class Test_MyControllerExtension {
public static testmethod void test()
{
Profile p = [select id from profile where name='Some Profile'];
User testUser = new User(alias = 'u1', email='u1@testorg.com',
emailencodingkey='UTF-8', lastname='Testing', languagelocalekey='en_US',
localesidkey='en_US', profileid = p.Id, country='United States',
timezonesidkey='America/Los_Angeles', username='u1@testorg.com');
insert testUser;
}
}
regards
venkatesh
if(u2.UserRoleId!= u.UserRoleId)
how to check this condition . here we are not mension the userroleId .
try this.
I suggest you to change your trigger code to something like this.