• Sam Karn
  • NEWBIE
  • 0 Points
  • Member since 2020

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 3
    Replies
I have couple of objects and the relationship is as follows

1)Acount
2)Opp
3)contact
4)Planning 
5)Management
 

Account has a ralationmship with the Opp object and planning has a lookup relatiomship with Opp and management has a lookup wiht thr planining

I have created email field on the Management object 

I have trigger on the planning object and from planning I am extracting management reord which are basically copied contacts from the contact object known as special contacts.If more record are added in the contact object I need to match email on the management with email on the contact object and if they match it means management has that record so no need to insert just update that record..If the email does not match then copy that contact object to the management object......Management has no direct relationship  realtionhip withe contact object

Relationship goes like this:- 

Starting backwards from management------Plannnig -----Opp-----Account-----Contact
 
My code is  not complete and I have focussed on after udpate trigger assuning that certain records with thei email address already esists in the Management object and new we gonna update them if the email matches with the email on the contact object


Problem is at the line where I am checking if the email from the contact record exists in the map of Management object.I know email exists in both the objects but it's always giving me null value so please help me out.


trigger UpdateStartegicPlanning on Strategic_planning__c (after update)
{
    set<string>EmailtoLastname=new set<string>();
    set<id>IdofStrategicplan=new set<id>();
    set<id>storeoppIds=new set<id>();
    for(Strategic_planning__c Str:trigger.new)
    {
       
      IdofStrategicplan.add(str.id);  
           
    }
     list<Realtionship_Management__c>ManageRec=([select Key_Contacts_Email_Address__c from Realtionship_Management__c where Strategic_planning__c=:IdofStrategicplan]);
    //might need maoo for the above line
    //
    //        
    
    Map<string,Realtionship_Management__c>must=new Map<string,Realtionship_Management__c>();
    
    for(Realtionship_Management__c Mrecords:ManageRec)
    {
        
        
      must.put(Mrecords.Key_Contacts_Email_Address__c,mrecords);
        
        
    }

for(Strategic_planning__c Check:Trigger.new)
   {
 
       
       
       storeoppIds.add(check.opportunity__c);
            
       
   }
  

    
list<opportunity>newOppIds=[Select id,accountid from opportunity where id in:storeoppIds];
set<id>accountids=new set<id>();
for(opportunity ids:newoppids)
{
accountids.add(ids.accountid);    
system.debug('the account id is'+accountids);   
   
}    
List<account>str=[select id,(select id,Key_Contact_Account_Planning__c,lastname,email from contacts where Key_Contact_Account_Planning__c=true)from account where id in:accountids];
   
list<Realtionship_Management__c>management=new list<Realtionship_Management__c>();

for(Strategic_planning__c plan1:trigger.new)
{
System.debug('The strategic planning id is'+plan1);
for(account s:str)
{
  System.debug('The account info is is'+s);  
    
for(contact contra:s.contacts)
{
    
    if(must.containskey(contra.email))
    {
       system.debug('the email address is');
        //+EmailRelation.containskey(contra.email)); 
    }
    else
    {
        system.debug('the email address is not good');
        
        
    }
     
    
    
}    
}    
}
}    



 





 
We have apex classes through which we send emails based on user action in force.com sites. It was working great until Friday, But yesterday when one of our customer try to submit application, they were getting error, In debug it says “SendEmail failed. First exception on row 0; first error: UNKNOWN_EXCEPTION, INVALID_TYPE: sObject type 'SalesforceIqDataSource' is not supported.: []”. I am pretty sure we did not change anything related to apex class, email template, vf page etc.. Does anyone know the reason or best way to fix this?
Ans:  Text, Text Area, Text Area Long, Rich Text Area, URL. Is this is the right answer or is there something else????

13. Can we change the data type from Text to Auto Number for the Name when we already have?

Ans: I feel the answer is yes. If yes, please do let me know the explanation . If no, let me know the reason as well. Thanks guys.