• pathi bahubhali
  • NEWBIE
  • 10 Points
  • Member since 2015

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 5
    Questions
  • 1
    Replies
hi 
here my question is to refresh the field level under input field. 
here the problem is i am unable to refreshing the another field..
why because i am using input field ..

Please reply me with suitable approach.
Thanks in advance,
kattappa.
hi 
Here my requirement is  new account is having already 2 contacts.
when ever a new contact record is created then add that contact to "New account".
 
here i have written trigger.
trigger contrig on Contact (after insert) {
  
    for(contact con:Trigger.new)   
   {
    
       account newacc=[SELECT Id,Name FROM Account WHERE Name = 'new account'];
      con.accountid = newacc.id;
    insert con;
  }
 }

thanks in advance,
kattappa
 
how will a standard / custom controller recognize the extension?
1)consider there are multiple users with same profile with all permissions enabled on an object (create, edit, delete etc). how can i remove delete permission for 2 users out of them?




Thanks in Advance
My requirement ,
I have one  clone button, when i click clone button from account detail page it has to copy the account and it's associated contacts ,opportunities.
Here i have written some peice of code but it's not working please help me regarding this.
From this code i am able to clone account with associated contacts but opprtunites.
VF page is :
<apex:page StandardController="Account" extensions="Sample" sidebar="false" showHeader="false">
url={!$CurrentPage.parameters.Id}

<apex:form >

    <apex:pageblock id="pb">
        
              <apex:outputLabel >Enter The Account Id:</apex:outputLabel>&nbsp;&nbsp;   
              <apex:inputText value="{!idOfRec}" />            
        
        <apex:pageblockButtons location="top"><br/><br/><br/><br/><br/>
            <apex:commandButton value="Are You Sure" action="{!cloneRec}" />
            <apex:commandButton value="Cancel" action="{!cancel}"/>
        </apex:pageblockButtons>
    </apex:pageblock>   
</apex:form>

</apex:page>

Apex Class:
public class Sample1
{ 
   public string Id{set;get;}
     public Sample1(ApexPages.StandardController controller) {

  
    }
    
    public String idOfRec{set;get;} 
             
   
    public pagereference cloneRec()
    {
       list<contact> cons=new list<contact>();
        list<opportunity> opp=new list<opportunity>();
   
      Schema.Account acc = [SELECT ID, Name FROM Account WHERE Id = : idOfRec];
        Schema.Account accCopy = acc.clone(false,true);
        insert accCopy;
         list<contact> con = [SELECT Id, LastName, AccountId FROM Contact WHERE AccountId = : acc.Id];
         list<opportunity> opp1=[select Id, Name, AccountId FROM opportunity WHERE AccountId = : acc.Id];
       
        for(Contact c : con)
        {
            Contact conCopy = c.clone(false,true);
            conCopy.AccountId = accCopy.Id;
            cons.add(conCopy);
        }
        insert cons;
        for(opportunity op : opp1)
        {
            opportunity oppCopy = op.clone(false,true);
            oppCopy.AccountId = accCopy.Id;
            opp.add(oppCopy);
        }
        insert opp;
        pagereference pg=new pagereference('/'+accCopy.id);
        pg.setredirect(true);
        return pg;
    
       }
}
Thanks in Advance......!
kattappa
 
My requirement ,
I have one  clone button, when i click clone button from account detail page it has to copy the account and it's associated contacts ,opportunities.
Here i have written some peice of code but it's not working please help me regarding this.
From this code i am able to clone account with associated contacts but opprtunites.
VF page is :
<apex:page StandardController="Account" extensions="Sample" sidebar="false" showHeader="false">
url={!$CurrentPage.parameters.Id}

<apex:form >

    <apex:pageblock id="pb">
        
              <apex:outputLabel >Enter The Account Id:</apex:outputLabel>&nbsp;&nbsp;   
              <apex:inputText value="{!idOfRec}" />            
        
        <apex:pageblockButtons location="top"><br/><br/><br/><br/><br/>
            <apex:commandButton value="Are You Sure" action="{!cloneRec}" />
            <apex:commandButton value="Cancel" action="{!cancel}"/>
        </apex:pageblockButtons>
    </apex:pageblock>   
</apex:form>

</apex:page>

Apex Class:
public class Sample1
{ 
   public string Id{set;get;}
     public Sample1(ApexPages.StandardController controller) {

  
    }
    
    public String idOfRec{set;get;} 
             
   
    public pagereference cloneRec()
    {
       list<contact> cons=new list<contact>();
        list<opportunity> opp=new list<opportunity>();
   
      Schema.Account acc = [SELECT ID, Name FROM Account WHERE Id = : idOfRec];
        Schema.Account accCopy = acc.clone(false,true);
        insert accCopy;
         list<contact> con = [SELECT Id, LastName, AccountId FROM Contact WHERE AccountId = : acc.Id];
         list<opportunity> opp1=[select Id, Name, AccountId FROM opportunity WHERE AccountId = : acc.Id];
       
        for(Contact c : con)
        {
            Contact conCopy = c.clone(false,true);
            conCopy.AccountId = accCopy.Id;
            cons.add(conCopy);
        }
        insert cons;
        for(opportunity op : opp1)
        {
            opportunity oppCopy = op.clone(false,true);
            oppCopy.AccountId = accCopy.Id;
            opp.add(oppCopy);
        }
        insert opp;
        pagereference pg=new pagereference('/'+accCopy.id);
        pg.setredirect(true);
        return pg;
    
       }
}
Thanks in Advance......!
kattappa