• Karen Hanson
  • NEWBIE
  • 20 Points
  • Member since 2015
  • California, United States

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 4
    Questions
  • 1
    Replies
Is it possible in salesforce configuration to get field values of two different objects X, Y related to object Z ? and can I show it on page layout as a related list
User-added image
HI ,
I have a custom field called Create_Contact__c that is a data type "checkbox". in Account object and
I need to evaluate it in an apex trigger. and create new contact record when it is checked in account object .

Error: Compile Error: Variable does not exist: Create_Contact__c at line 3 column 6​
 
trigger CreateAccountContact on Account (after insert, after update){

  if(Create_Contact__c == True)  {

    List<Contact> ct = new List <Contact>();

    for(Account acc : trigger.new){
    
        Contact c = new Contact(LastName = acc.name,
                    AccountId=acc.id,
                    Fax=acc.Fax,
                    MailingStreet=acc.BillingStreet,
                    MailingCity=acc.BillingCity,
                    MailingState=acc.BillingState,
                    MailingPostalCode=acc.BillingPostalCode,
                    MailingCountry=acc.BillingCountry,
                    Phone=acc.Phone);

        ct.add(c);
    }
    insert ct; 
}
}

 
i have a  requirement when only account field type update to Prospect the related opp stage name  update's Prospect ,but her whenever i chage any field in account . the opp stage names update's Prospect .
 
trigger updateopportunities on Account(after update) 
{
    Set<Id> accountIds = new Set<Id>(); //new set of IDs 
    for(Account ac : Trigger.new)     //bulklification 
    {
         {
            if(ac.Type!=trigger.oldMap.get(ac.Id).name)   // er
         

         if(ac.Type=='Prospect')        //if axcount if of prospect
         accountIds.add(ac.Id);         //add it to set values 
       {
    }

     List<Opportunity> oppsToUpdate = new List<Opportunity>();      //new list 

     for(Opportunity opp : [select id, StageName from Opportunity where AccountId in: accountIds]) //bulklification   query for stagename ,id from opportunity
     {
          opp.StageName='Prospect';      
          oppsToUpdate.add(opp);         //  adding to the list     
     }

     update oppsToUpdate;               //update the opp
}
}
}

 
Hi
I do have a requirement in which two record type  A and b on opportunity I have created it !
“A”  record type  should have a button convert to “B” record type  which when clicked should display an alert ‘Click yes to Proceed’ if yes, then show a page where amount can be entered. while saving , ensure that it is greater than 10k usd and then redirect to B record type  page
 
Is it possible in salesforce configuration to get field values of two different objects X, Y related to object Z ? and can I show it on page layout as a related list
User-added image