You need to sign in to do that
Don't have an account?
Gunwinder 11
Fetching values from one list to another
Experts,
I am a novice to Apex and having trouble to build a class wherein I want to fetch values from one list to another.
On USER object, Gold_Partner_User__c and Customer_Portal_User__c are formula fields which identify the type of license assigned.
Our customers who do not have access to USER object, I have created Customer_Portal_Lic_assigned__c on contact object so that a contact list view / report could be created for them.
I want to build a scheduled apex job that identifies contacts where users who are mapped with a customer portal license are identified and the related contact object is updated with the checkbox.
Kindly suggest how should be best done.
I am a novice to Apex and having trouble to build a class wherein I want to fetch values from one list to another.
List<User> UsersList = [select id,contactid,Gold_Partner_User__c,Customer_Portal_User__c FROM USER WHERE isActive=TRUE AND Customer_Portal_User__c = TRUE]; List<contact> ContactList =[Select id,Customer_Portal_Lic_assigned__c FROM contact WHERE ID IN : UsersList AND Customer_Portal_Lic_assigned__c=FALSE];background:
On USER object, Gold_Partner_User__c and Customer_Portal_User__c are formula fields which identify the type of license assigned.
Our customers who do not have access to USER object, I have created Customer_Portal_Lic_assigned__c on contact object so that a contact list view / report could be created for them.
I want to build a scheduled apex job that identifies contacts where users who are mapped with a customer portal license are identified and the related contact object is updated with the checkbox.
Kindly suggest how should be best done.
Please use below query:-
if you need any assistanse, Please let me know!!
Kindly mark my solution as the best answer if it helps you.
Thanks
Mukesh
Test class :
Is it a best practise to use :
- System.runAs(adminUser) or is it due to the limitation of how records are inserted. Since I am learning APEX I want to make sure If I should use it as rule of thumb (kind of boiler plate code) and always use in creating test classes.
- system.asssetEquals();
Currenty I had commented it because it was throwing an error : Method does not exist or incorrect signature: void asssetEquals(Integer, Integer) from the type SystemPlease suggest as why is it causing an issue or if there is a better way to do it.