• Saru Vadlamudi
  • NEWBIE
  • 15 Points
  • Member since 2014
  • SE
  • NCR

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 6
    Questions
  • 4
    Replies
We are facing the issue with soql 101 error while deploying trigger.We have tried to capture the issue in all the ways.please let me know where could be the causing an isssue in below code.its an urgent request.

trigger contactdetails on Contact (before update) {
Map<id,id> cntctOwnerMap = new Map<id,id>();
Map<id,id> accountOwnerMap = new Map<id,id>();
Map<id,id> accountTeamMap = new Map<id,id>();
Map<id,id> accountidMap = new Map<id,id>();
Map<id,id> accountTeamMember = new Map<id,id>();


List<contact> ct1 = new List<Contact>();
set <string> profileids = new set<string>{'00e700000013gAKAAY','00e700000013gPeAAI','00e700000013YgPAAU','00e70000000x3egAAA','00e70000000x8q3AAA','00e70000000xE3lAAE','00e70000000xE7xAAE','00e70000000sR8UAAU','00e70000000xBqJAAU','00e70000000x3XVAAY','00e700000013YIGAA2','00e70000000x3oSAAQ'};
set <id> userIds = new set<id> {'00570000001u6pxAAA','00570000002VUUlAAO','00570000001R8tOAAS'};
List <id> accountids = new List<id>();
String currentprofileid = Userinfo.getprofileid();
map<id,set<id>> a = new map<id,set<id>>();
List<accountteammember> acc = new List<accountteammember>();

ct1 = [select id , ownerid , account.ownerid , accountid from contact where id in : trigger.newMap.keySet()];
for(Integer i = 0 ; i<ct1.size() ; i++)
{
cntctOwnerMap.put(ct1[i].id,ct1[i].ownerid);
}

for(Integer i = 0 ; i<ct1.size() ; i++)
{
accountOwnerMap.put(ct1[i].id,ct1[i].account.ownerid);
}

for(Contact ct: ct1)
{
accountidMap.put(ct.id,ct.accountid);
accountids.add(ct.accountid);
}
acc = [select id , accountid , userid from accountteammember where accountid in : accountids];
for(Id ab : accountids)
{
set <id> aa = new set < id > ();
for(accountteammember at: acc)
{
if(at.accountid==ab)
{
aa.add(at.userid);
}
}
a.put(ab,aa);
}

for(contact c : trigger.new){

if(userinfo.getuserid()==cntctOwnerMap.get(c.id) || userinfo.getuserid()==accountownermap.get(c.id) || a.get(accountidMap.get(c.id)).contains(userinfo.getuserid()) || profileids.contains(userinfo.getprofileid()) || userIds.contains(userinfo.getuserid()))
{}else{
c.adderror('You are not authorized to make any change on the Contact.');
}
}
}



i have the scenario that workflow has to trigger before 180 days of end date.
When i testing with providing all the criteria satisfied even then email in not triggering.
Please suggest me how to test it.
i have time dependent workflow action for email alert which will trigger on before end date of 180 days .
The requirement is to customize the from email address in email alert so i would be write code to convert workflow logic into apex logic.
Please suggest me how can i achive this functionality.
We have enabled the SSO settings in system and wroking fine for all users from long time.
Recently we faced the issue for only 5 users while login through single sign on and it says that ""Internal Server error" .
We tried to find the issue in all the ways but no solution .Please let me know if anybody have an idea about when the "Internal Server error" (login history message)message will be come for users while login through sso.
Can any one help me out that how to cover the code coverage for below catch excpetion in test class.
I dont have permission to change Apex Controller so it has to do something in test class itself.

catch(Exception e) {
         new ApexPages.Message(ApexPages.Severity.Error,'Easy Button Config Custom Setting doesn\'t exist!');
     } 
i have test class for vf controller where as soql which is not not covering in code coverage even after inserting one test opp record.Please suggest me that how to get cover this soql.Here oppId is currentpage parameter.
In debug logs opppDeatils list value is coming as 0 but test opp record is inserted in test class.

List<Opportunity> oppDetails =[Select Name
From Opportunity
Where Id =:ApexPages.currentPage().getParameters().get('oppID')];
i have test class for vf controller where as soql which is not not covering in code coverage even after inserting one test opp record.Please suggest me that how to get cover this soql.Here oppId is currentpage parameter.
In debug logs opppDeatils list value is coming as 0 but test opp record is inserted in test class.

List<Opportunity> oppDetails =[Select Name
From Opportunity
Where Id =:ApexPages.currentPage().getParameters().get('oppID')];