• Neezen
  • NEWBIE
  • 30 Points
  • Member since 2013

  • Chatter
    Feed
  • 1
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 2
    Replies

Greetings,

 

I am attempting to change the color of text in a visualforce page.  I am doing the logic in the contoller and passing the variable to the VF page.  The problem is I am comparing a lookup field to a set of IDs.  If the ID is not in the list, I want to change the color.  I think I can get there with a nested for loop but it is not best practice.  Any input on how to acheive this is greatly appreciated.

 


public String getcolor1(){
LIST<user> users= new list<user>();
users = [select id, name from user where userrole.name = 'Executive' or userrole.name='Ops Team 8'];
set<id> uid = new set<id>();

for(user us: users){
uid.add(us.id);
}

 

String color='red';
list<carrier__c> Ids = [select id, team__c from carrier__c where team__c != NULL];
//system.debug('***** cid = '+cid);
system.debug('***** uid = '+uid);
system.debug('***** Ids = '+Ids);

for(carrier__c car: ids){
if(car.team__c ! NOT IN: uid){   //  This is incorrect logic.  comparing an ID (lookup field) to a set of IDs.  Perhaps I should have a nested for loop?
color='blue';
}
// }
}
return color;
}

 

 

 

Currently everything in the list is blue and some should be red.

Hi All,

 

I am having really tough time dealing with Salesforce Test classes.

 

My first problem is when I write a test class, then the class I am testing does not show up in Overall Code Coverage.

 

Then when I click on test the class does show up in Class Code Coverage and show me the coverage % but when I click on it it opens without the colors telling me which line is covered and which is not.

 

 

Please let me know how to resolve this.

 

Thanks.