You need to sign in to do that
Don't have an account?
salesforce instance
help to cover lines in test class
if(Trigger.isBefore && Trigger.isInsert)
{
for(Case c : lscase)
{
acntsIds.add(c.AccountID);
}
List<Contact> ls = new List<Contact>([SELECT id, Name, Email from Contact where AccountId IN : acntsIds]);
for(Contact c : ls)
{
conIds.add(c.Id);
}
for (case CaseX: lscase)
{
if(!conIds.contains(CaseX.ContactID))
{
CaseX.addError('Please select valid Contact using Lookup Search Icon');
}
}
}
if(Trigger.isAfter && Trigger.isInsert)
{
List<Case> CasesToInsert = new List<Case>();
for (case CaseX: trigger.New)
{
Case NewCase = new Case(Id = CaseX.Id);
List<User> usrList = new List<User>([SELECT id, Formula_Profiel_name__c from user where Id = :UserInfo.getuserId() LIMIT 1]);
List<User> CntList = new List<user>([SELECT id, Name, Email, UserName from User where ContactId = :CaseX.ContactID LIMIT 1]);
for (User usr : usrList)
{
if(Usr.Formula_Profiel_name__c == System.Label.U4_PS_Consultant) {
NewCase.PS_Owner__c = UserInfo.getuserId();
Update NewCase;
{
for(Case c : lscase)
{
acntsIds.add(c.AccountID);
}
List<Contact> ls = new List<Contact>([SELECT id, Name, Email from Contact where AccountId IN : acntsIds]);
for(Contact c : ls)
{
conIds.add(c.Id);
}
for (case CaseX: lscase)
{
if(!conIds.contains(CaseX.ContactID))
{
CaseX.addError('Please select valid Contact using Lookup Search Icon');
}
}
}
if(Trigger.isAfter && Trigger.isInsert)
{
List<Case> CasesToInsert = new List<Case>();
for (case CaseX: trigger.New)
{
Case NewCase = new Case(Id = CaseX.Id);
List<User> usrList = new List<User>([SELECT id, Formula_Profiel_name__c from user where Id = :UserInfo.getuserId() LIMIT 1]);
List<User> CntList = new List<user>([SELECT id, Name, Email, UserName from User where ContactId = :CaseX.ContactID LIMIT 1]);
for (User usr : usrList)
{
if(Usr.Formula_Profiel_name__c == System.Label.U4_PS_Consultant) {
NewCase.PS_Owner__c = UserInfo.getuserId();
Update NewCase;