• Raj Chatterjee
  • NEWBIE
  • 0 Points
  • Member since 2019

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

How to hide a field on creating page but visible on details page?

Only using Standard Tool .

Can anyone tell why getting this error.Here is my code
public class insertclass 
{
   public static void insertMethod(string LastNameOfAccount)
   {
       List<Account> acclist = New List<Account>();      
           account acc = new account();
           acc.name = LastNameOfAccount;
           acclist.add(acc);         
        system.debug('.....acclist'+acclist);
         insert acclist;
       List<Account> acc1 = New List<Account>();
       acc1 = [SELECT Name,Id From Account Where name =:LastNameOfAccount];
       system.debug('acc1...'+acc1);
       Id accountId;
       for (Account acc23: acc1)     
       {
           accountId = acc23.Id ;
           system.debug('acc2---'+accountId);
       } 
         List<Contact> conlist = New List<Contact>();
         for(integer i = 0; i<2; i++)
         {           
            Contact con = new contact();
            con.Firstname = 'Test'+ string.valueOf(i);
            con.Lastname = 'Ramesh';
            con.accountId =  accountId ;
            conlist.add(con);       
         }      
         system.debug('.....conlist'+conlist);
         insert conlist;
     }
                    List<opportunity> opplist = New List<opportunity>();
error line >        for(integer i = 0; i<2; i++)
              {           
            opportunity opp = new opportunity();
            opp.Firstname = 'Test'+ string.valueOf(i);
            opp.Lastname = 'Ramesh';
            opp.accountId =  accountId ;
            opplist.add(opp);       
         }      
         system.debug('.....opplist'+opplist);
         insert opplist;
     }
Thanks is advance.

How to hide a field on creating page but visible on details page?

Only using Standard Tool .