• Ranadheer ch
  • NEWBIE
  • 135 Points
  • Member since 2014

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 29
    Questions
  • 13
    Replies
I want to upload AccountTeamMember object records in to custom object .....so here i have a custom object called AccountTeamDuplicate__c...when i insert AccountTeamMember From account i want those records should get inserted into this(AccountTeamDuplicate__c) custom object ...  How to write a trigger for this ...please help me ...thanks
Hi I wrote a trigger to bring the account team member Userid to account...The following trigger is updating the value to accoount object...which is fine ...but the problem is its is updating when i click on EDIT & then SAVE on account...Here i need that value is updated when i enter the ACcount team ...how it is possible?


trigger bringAccountTeamMember on Account (before insert, before update) {
    
    set<ID> Accountids = new set<id>();
        
    for (Account Acc : trigger.new) {
        Accountids.add(Acc.id);  
        List<AccountTeamMember> AccTeam = [ select id,User.name from AccountTeamMember cm
                                            where AccountID = :Accountids
                                             order by User.name limit 1 ];
        
        if (AccTeam.isEmpty() == false){
           for (AccountTeamMember Accteams : AccTeam) {
                Acc.Account_Team_Member__c = Accteams.User.name;
           }
        }  
    } 
}
How to Add Relation ship field Id to javascript Button...For Example:  Account Address(Account_Address__c) Object. In this object i have a Account__C( field) value Which has a Master Detail Relation ship with Account. 


Now created a Javascript Button on Account_Address__C detail page . nOw my requirement is i have to send Account_Address_Id  and Account__c.Id Through this button ...How can i do that Please help me ...i ried the below code

Button:


{!REQUIRESCRIPT("/soap/ajax/30.0/connection.js")} 
{!REQUIRESCRIPT("/soap/ajax/30.0/apex.js")} 
//alert('hi'); 
if('{!Account_Address__c.Id}'!= null) 

alert('Do You Want To Create A SAP Account'); 
var AcctAddressID='{!Account_Address__c.Id}';
Var AccountID='{!Account_Address__c.Account__c.ID}' 
sforce.apex.execute("Bandvidth CreateUpdateSAPAccountAddress","createupdateSAPAccountAddress",{AcctAddressID:"{!Account_Address__c.Id}",{AccountID:"{!Account_Address__c.Account__c.ID}}); 
}


Am getting below Error while saving the button:

Error: Field Account_Address__c.Account__c.ID does not exist. Check spelling.


Please help me..thanks








 
I created a javascript button and passing Account ID and calling apex classes .When i click on button on account detail page am getting the Error when i press that button like  "A Problem with this button or link was Encountered       Unexpected Identifier"  


Button:


{!REQUIRESCRIPT("/soap/ajax/30.0/connection.js")} 
{!REQUIRESCRIPT("/soap/ajax/30.0/apex.js")} 

if({!Account.Name}!=Null) 

sforce.apex.execute("SandvineCreateUpdateSAPAccount","createupdateSAPAccount",{!Account.Id}"}); 
alert("This is {!Account.Name}"); 
}



Why am getting this error ...this button send the account ID to the external URL
Client provided the sample endpoint url from an magic external system...called "Account Update Endpoint" ...and that url holding the Account ID. Now my question is how to Add that url to my salesforce sandbox ...is there any method to add that URL here ...please help me in this thanks

The URL like:
Http://***********************XYZ_Endpoint&AccountID=0017******qfaoh.


How to connect this url in my salesforce...that account ID is existed in salesforce 


Help me inthis ...Thanks In Advance
 
There is button name called as "create Member in sap" from account deatl page.in salesforce..so here that button will create the Member in sap once i ckick on that button....for this we have used the Skyvva integration suite from app exchange as managed  pakage.Now what my requirement is we are moving out of that skyvva ...and connecting with some middleware..so now we want to use the REST Base Api for this ..

Here how can i create a class with some end point(Rest) the class should hold the account id...

If there is class i can call that class in this button..




 
Here am writing the parent -child query ...account parent and Entitlement is child...why it is not working..

select id,name,(select Entitlement.name,Entitlement.Status from entitlement) from account



Help me in this ...thanks in advance...
When a user click on case object ....he will select account and asset through lookup...now what my requirement is I want to populate the entitlements with for that account and asset on detail page ....if there are 2 entitlements then recent should populate ....what to do for this...help me please
 
How to provide an account id to external system like(3rd party) using javascript button on account detail page....any examples or code?....here i will use the Rest Api

When i click on that button of account detail page  then then third partys object like customer record should create...Using REst Api

Help me ...thanks in advance





 
Please Help me ...How to provide a webservice class to provide the account Id..Please Help me ...How to provide a webservice class to provide the account Id..in query i want to add all the fields ....


Help me in this ...thanks in advance
Here inthis page using the {!SaveDueFrom} i can insert the input text values into object..but i also want to insert the inputfiled values also with the same action what to do? How to pass that to that SaveDueFrom method in controller.

My vf page:
<apex:page standardController="File_New_Protest__c" Extensions="Filenewexten">
<apex:form>
<apex:pageBlock >
<apex:pageBlockSection title="Protester " columns="3">
<apex:inputText value="{!CompanyName}" />
<apex:inputText value="{!StreetName}" id="cstreet"/>
<apex:inputField value="{!File_New_Protest__c.Agency_Tier1__c}"/>
<apex:inputField value="{!File_New_Protest__c.Comments__c}"/> 
<apex:commandButton value="Save" action="{!SaveDueFrom}"/>
</apex:pageBlockSection>
</apex:pageBlock >
<apex:form>
<<apex:page>

My controller:

public with sharing class Filenewexten {
public Filenewexten(ApexPages.StandardController controller) {
}
 public string  CompanyName{get;set;}
      public string  StreetName{get;set;}

public Void SaveDueFrom(){
File_New_Protest__c Insertfile=New File_New_Protest__c();
 Insertfile.Company_Name__c=CompanyName;
Insertfile.Street_Name__c=StreetName;
insert(Insertfile);
}


please help me inthis ...thanks in advance
I have a problem that i created a vf page and controller also but the problem is i cannot save the picklist field Agency_tier __c into fiel new protest object ...i dont know why...this is a picklist field (<apex:inputField value="{!File_New_Protest__c.Agency_Tier1__c}"/>) but am unable to save this field into an object ...when i click on save remaining all the fields are saving but this picklist field value is not saving


My vf page:

<apex:page standardController="File_New_Protest__c" Extensions="Filenewexten">
<apex:sectionHeader title="Protest Info Form" />

<apex:form id="fid">
<apex:pageMessages ></apex:pageMessages>

<apex:pageBlock >
<apex:pageBlockSection title="Protester " columns="3">
<table>
<tr>
<td>
Company Name: 
<apex:inputText value="{!CompanyName}" />
</td>
</tr>
<tr>
<td>
<apex:selectRadio value="{!File_New_Protest__c.Size_Status__c}">
<apex:selectoptions value="{!typess}"></apex:selectoptions>
</apex:selectRadio> 
</td>
</tr>
</table>
</apex:pageBlockSection>
<apex:pageBlockSection title="Company Address" columns="2">
<table>
<div style="padding-top: 15px;padding-bottom: 15px;padding-left: 70px;">                                 
                                    <input type="checkbox" name="sameasadress" id="sameasaddressid"><label>&nbsp;Same as Protester Representative address below</label>
                                </input>
                             </div>
<tr>
<td>
Street Name:
<apex:inputText value="{!StreetName}" id="cstreet"/>
</td>
</tr>
<tr>
<td>
City:
<apex:inputText value="{!City}"/>
</td>
</tr>
<tr>
<td>
State:
<apex:inputText value="{!State}" />
</td>
</tr>
<tr>
<td>
Country:
<apex:inputText value="{!Country}" />
</td>
</tr>
<tr>
<td>
Zip Code:
<apex:inputText value="{!ZipCode}" />
</td>
</tr>
</table>
</apex:pageBlockSection>

</apex:pageBlock>
<!--<apex:pageblock >

<apex:pageBlockTable value="{!DueFromEntityDetials}" var="Ent" style="font-size:1.1em;" id="TheBlock">
<apex:pageBlockSection columns="2">
<table>
<tr>
<td>
<apex:outputTExt></apex:outputTExt> value="{!Ent.First_Name__c}"/>
</td>
</tr>
<tr>
<td>
<apex:outputField value="{!Ent.Last_Name__c}"/>
</td>
</tr>
</table>
</apex:pageBlockSection>
</apex:pageblocktable>
</apex:pageblock>-->
<apex:pageBlock >
<apex:pageBlockSection title="Protester Representative " columns="2">
<table>
<tr>
<td>
First Name:
<apex:inputText value="{!FirstName}"/>
</td>
</tr>
<tr>
<td>
Last Name:
<apex:inputText value="{!LastName}"/>
</td>
</tr>
<tr>
<td>
Email Address:
<apex:inputText value="{!Email}" />
</td>
</tr>
<tr>
<td>
Phone Number:
<apex:inputText value="{!PhoneNumber}" />
</td>
</tr>
<tr>
<td>
Fax Number:
<apex:inputText value="{!FaxNumber}" />
</td>
</tr>
<tr>
<td>
Street Address:
<apex:inputText value="{!StreetAddresses}"  id="pstreet"/>
</td>
</tr> 
<tr>
<td>
City:
<apex:inputText value="{!Cities}" />
</td>
</tr>
<tr>
<td>
State:
<apex:inputText value="{!States}" />
</td>
</tr>  
<tr>
<td>
Country:
<apex:inputText value="{!Countrys}" />
</td>
</tr>  
<tr>
<td>
Zipcode:
<apex:inputText value="{!ZipCode_rep}" />
</td>
</tr>  
<tr>
<td>
Solicitation Number:
<apex:inputText value="{!Solocitation}" />
</td>
</tr>
<tr>
<td>
<apex:inputField value="{!File_New_Protest__c.Agency_Tier1__c}"/>
</td>
</tr>
<tr>
<td>
<apex:inputField value="{!File_New_Protest__c.Agency_Tier2__c}" />
</td>
</tr>
<tr>
<td>
<apex:inputField value="{!File_New_Protest__c.Comments__c}"/> 
</td>
</tr> 
<tr>
<td>  
</td>
</tr> 
</table> 
 </apex:pageBlockSection>
 <apex:pageBlockSection title="Protester Representative " columns="2">
 <table>
 <tr>
<td>
Attachment: 
<apex:inputFile accept="doc, txt, pdf" filename="{!fileName}" contentType="{!contentType}" filesize="1000" size="50" value="{!DFAttachment}"/>
</td>
</tr>
  <tr>
  <td>
  Do you want to Upload Associated Documents
  <apex:actionRegion >
  <apex:actionSupport event="onchange" />
    <apex:selectRadio value="{!File_New_Protest__c.Do_U_Want_To_Upload_Associated_Documents__c}">
    <apex:selectoptions value="{!types}"></apex:selectoptions>
    </apex:selectRadio>
    </apex:actionRegion>
    </td>
    </tr>
    <tr>
    <td>Upload Associated Documents
    
    <apex:inputFile accept="doc, txt, pdf" filename="{!fileName}" contentType="{!contentType}" filesize="10000" size="50" value="{!DFAttachment}" id="DocID"/>            
    </td>

    <td>
    </td>
    </tr>

<tr>
<td>
<!--<apex:param name="aid" value="" />-->
<apex:commandButton value="Save" action="{!SaveDueFrom}"/>
</td>
</tr>
<tr colspan="2"> 
<td colspan="2">
<!--<apex:param name="aid" value="" />-->
<apex:commandButton value="Submit" action="{!searchAndfind}"/>
</td>
</tr>

</table>
 </apex:pageBlockSection>
 </apex:pageBlock>
 <script type="text/javascript">
 $('#sameasaddressid').click(function(event) { 
                        
                        
                         
                       if(this.checked==true)
                        {
                            
                            $('#ccountry').val($('#pcountry').val());
                            $('#cstate').val($('#pstate').val());
                            $('#ccity').val($('#pcity').val());
                            $('#czipcode').val($('#pzipcode').val());
                            $('#cstreet').val($('#pstreet').val());
                        
                        }else
                            {
                            
                                $('#ccountry').val("");
                                $('#cstate').val("");
                                $('#ccity').val("");
                                $('#czipcode').val("");
                                $('#cstreet').val("");
                            }
                         
                         
                     });
 </script> 
</apex:form>
</apex:page>


My controller:

public with sharing class Filenewexten {

public List<User_Profile__c> up { set; get; }

    public Filenewexten(ApexPages.StandardController controller) {
    
     up = [SELECT First_Name__c,Last_Name__c,Email__c,Phone_Number__c,Fax_Number__c,Street_Name__c,City_del__c,State__c,Country_del__c,Zip_Code__c FROM User_Profile__c];
     FirstName = up[0].First_Name__c;
     LastName  = up[0].Last_Name__c;
     Email     = up[0].Email__c;
     PhoneNumber = up[0].Phone_Number__c;
     FaxNumber = up[0].Fax_Number__c;
     StreetAddresses = up[0].Street_Name__c;
     Cities = up[0].City_del__c;
     States = up[0].State__c;
     Countrys = up[0].Country_del__c;
     ZipCode_rep = up[0].Zip_Code__c;
     

    }
    
    public string  CompanyName{get;set;}
      public string  StreetName{get;set;}
        public string  City{get;set;}
          public string  State{get;set;}
            public string  Country{get;set;}
              public string  ZipCode{get;set;}
              public string  FirstName{get;set;}
              public string  LastName{get;set;}
              public string  Email{get;set;}
              public string  PhoneNumber{get;set;}
              public string  FaxNumber{get;set;}
              public string  StreetAddresses{get;set;}
              public string  Cities{get;set;}
              public string States{get;set;}
              public string  Solocitation{get;set;}
              public string  Countrys{get;set;}
              public string  ZipCode_rep{get;set;}
              


              
               // public string  CompanyName{get;set;}
               
               public String fileName {get; set;} 
                public String contentType {get; set;} 
                public Blob DFAttachment{get; set;}  
                public list <User_Profile__c> objEntityDetailss=new list<User_Profile__c>();
                 
                 
                          public List<SelectOption> getAgencyInfo(){
              List<SelectOption> options = new List<SelectOption>();
        
               Schema.DescribeFieldResult fieldResult =
                 File_New_Protest__c.Agency_Tier1__c.getDescribe();
               List<Schema.PicklistEntry> ple = fieldResult.getPicklistValues();
        
                   for( Schema.PicklistEntry f : ple)
                   {
                      options.add(new SelectOption(f.getLabel(), f.getValue()));
               }       
   return options;
}
                 
                 
                 
                 public List<SelectOption> getTypes(){
            Schema.sObjectType sobject_type = File_New_Protest__c.getSObjectType();

            Schema.DescribeSObjectResult sobject_describe = sobject_type.getDescribe();

            Map<String, Schema.SObjectField> field_map = sobject_describe.fields.getMap();
          
            List<Schema.PicklistEntry> pick_list_values = field_map.get('Do_U_Want_To_Upload_Associated_Documents__c').getDescribe().getPickListValues();

            List<selectOption> options = new List<selectOption>();

           for (Schema.PicklistEntry a : pick_list_values) {
                      options.add(new selectOption(a.getLabel(), a.getValue()));
          }
      return options;

}
                
        public List<SelectOption> getTypess(){
            Schema.sObjectType sobject_type = File_New_Protest__c.getSObjectType();

            Schema.DescribeSObjectResult sobject_describe = sobject_type.getDescribe();

            Map<String, Schema.SObjectField> field_map = sobject_describe.fields.getMap();
          
            List<Schema.PicklistEntry> pick_list_values = field_map.get('Size_Status__c').getDescribe().getPickListValues();

            List<selectOption> options = new List<selectOption>();

           for (Schema.PicklistEntry a : pick_list_values) {
                      options.add(new selectOption(a.getLabel(), a.getValue()));
          }
      return options;

}
public List<User_Profile__c> getDueFromEntityDetials()
    {             
        objEntityDetailss=[SELECT Id,First_Name__c,Last_Name__c FROM User_Profile__c];
        return objEntityDetailss;

    }
               
               
      public Void SaveDueFrom(){
      
      
      File_New_Protest__c Insertfile=New File_New_Protest__c();
      Insertfile.Street_Name__c=StreetName;
      Insertfile.City__c=City;
      Insertfile.State__c=State;
      Insertfile.Country__c=Country;
      Insertfile.Zip_Code__c=ZipCode;
      Insertfile.Company_Name__c=CompanyName;
                 if(DFAttachment!=null)
                                               {
                                               Insertfile.IsAttached__c=1;
                                              }
                                              else{
                                              Insertfile.IsAttached__c=0;
                                              }
                                              
                                              
                                             
//INSERT insertBal; 
        insert(Insertfile); 
                                             
    
{

if(DFAttachment!=null){  
      Attachment attach=new Attachment();  
      attach.Body=DFAttachment;  
      attach.Name=filename;  
      attach.ContentType=contentType;  
      attach.ParentID=Insertfile.id;  
   
          insert(attach);
          attach.clear();  
          Insertfile.clear();
          DFAttachment=null;
    
      }  
  } 
  apexpages.Message msg = new Apexpages.Message(ApexPages.Severity.Info,'Saved Successfully');  
   
  } 
  public pageReference searchAndfind() {
        pageReference pg = new pageReference('https://c.ap1.visual.force.com/apex/Activeprotests');
        pg.setRedirect(true);
        return pg;
    }       
  

  }


Please help me in saving this picklist field into file new protest object...i am calling this from standard controller only thanks.....
Onblur is not working with my vf page Why?


Here Is my Vf Page:


<apex:inputField value="{!File_New_Protest__c.Company_Name__c}" onblur="Company" />


But it is not showing the blur value in my box
How to control the excution of 2 triggers ...so here i have 3 triggers for an object ..so here i want to control those  triggers excution order...for example i have trigger1,trigger2,trigger3..........here what i need is first trigger2 should fire, after that trigger1 should fire, finally trigger3 should fire ...how can i achive that ? this is actually my interview question....help me ...thanks in advance
How to create a 2 non related objects in single pageblock section..

let us sat i have object__A(Id,name),Object__b(Id,name) ...two objects are non related ..how to include these 2 bobjects in a single pageblocksection

Help me thanks..
 
i created vf page for dispalying account list one side and contact list other side seperate by using the wraper class (i dont know weather i can use two wraper classes in one class or not ) here is vf page

vf page :
<apex:page controller="accountcontactwraper" sidebar="false" >
<apex:form >
<apex:commandButton value="save"/>
<apex:pageBlock >
<apex:pageBlockSection collapsible="false" columns="2">

<apex:pageBlockTable value="{!Accounttable}" var="a">
<apex:column >
<apex:inputCheckbox value="{!a.selected}"/>
</apex:column>
<apex:column value="{!a.acc.name}"/>
<apex:column value="{!a.acc.phone}"/>
</apex:pageBlockTable>

<apex:pageBlockTable value="{!contacttable}" var="C">
<apex:column>
 <apex:inputCheckbox value="{!c.select}"/>
</apex:column>
<apex:column value="{!a.con.name}"/>
<apex:column value="{!a.con.phone}"/>
</apex:pageBlockTable>
</apex:pageBlockSection>
</apex:pageBlock>

</apex:form>
</apex:page>

and my class:

public class accountcontactwraper {

  public List<accountcontactwrapercreate> Accounttable{get;set;}
  public string contacttable{get;set;}
  
 
 public accountcontactwraper (){
 
 if(Accounttable==null){
 Accounttable=New LIst<accountcontactwrapercreate>();
 for(Account accs:[select id,name,phone from account limit 10]){
 Accounttable.add(New accountcontactwrapercreate(accs) );
 }
 }
 if(contacttable==null){
 contacttable=New List<wrapercon>();
 for(contact cc:[select id,name,lastname from contact limit 10]){
 contacttable.add(New wrapercon(cc));
 }
 }
 }
 
 
 public class accountcontactwrapercreate{
 public Account acc{get;set;}
 public boolean selected{get;set;}
    public accountcontactwrapercreate(Account a){
    acc=a;
    selected=false;
    }
 }
 
 public class wrapercon{
 public contact con{get;set;}
 public boolean select{get;set;}
    public wrapercon(contact c){
    con=c;
    select=false;
    }
 }
 
 
}


now while saving this class am getting this error :
 accountcontactwraper Compile Error: unexpected token: 'select' at line 35 column 16

Help me thanks  in advance
 
i created example vf page but <apex:pagemassages is not working in that> 

MY VF PAge: 

<apex:page controller="Mysecond" sidebar="false" >

<apex:form >
<apex:pageMessages ></apex:pageMessages>

<apex:pageBlock title="Create New Account">
<apex:pageblockButtons >
   <apex:commandButton action="{!resave}" value="Save" reRender="THe"/>
</apex:pageblockButtons>
  <apex:pageBlockSection Title="Account Information">
  <apex:inputField id="THE" value="{!Account.Name}"/>
  <apex:inputField id="IDS" value="{!Account.Phone}"/>
  </apex:pageBlockSection>
  <apex:pageblockTable value="{!tabledispaly}" var="t" id="THe">
  <!--<apex:column>
  <apex:inputCheckbox value="{!t.selected}"/>
  </apex:column>-->
  <apex:column value="{!t.Name}"/>
  <apex:column value="{!t.Phone}"/>
  </apex:pageblockTable>
  
</apex:pageBlock>
</apex:form>

</apex:page>


Controller:

public with sharing class Mysecond {

LIst<Account>tabledispaly= New LIst<Account>();
 Account account;
 
 
      public List<Account>gettabledispaly(){
      tabledispaly=[select id,name,phone from account];
      return tabledispaly;
      }
 
 public Account getAccount(){
 if(Account==null)
 account=New account();
 return account;
 }
 
 public void resave(){
 insert account;
   ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.ERROR,'Saved Successfully'));
 
 //THis to send the user to detail page for new account
   // PageReference acctPage = new ApexPages.StandardController(account).view();
    //acctPage.setRedirect(False);
     // return acctPage;
 }
 
 
}


What can be the problem...THanks in advance:




 

i created basic vf page to display a+b=c ....this is working fine ...but i want to dispaly the values of A,B,C in pageblocktable how can i dispaly like so.


while saving the page am getting this error :Unknown property 'Integer.a'

vf page:

<apex:page controller="integercon" >
<apex:form >
Value Of A:<apex:inputText value="{!a}"/>
Value Of B:<apex:inputText value="{!b}"/>
Value Of C<apex:inputText value="{!c}"/>
<apex:commandButton action="{!savelist}" value="click"/>
<apex:pageBlock>
<apex:pageBlockTable value="{!dispaly}" var="r">
<apex:column value="{!r.a}"/>
<apex:column value="{!r.b}"/>
<apex:column value="{!r.c}"/>
</apex:pageBlockTable>
</apex:pageBlock>
</apex:form>
</apex:page>


Class:

public with sharing class integercon {
   public integer a{get;set;}
   public integer b{get;set;}
   public integer c{get;set;}
   
   public integer dispaly{get;set;}
    
    
    public void savelist() {
        c=a+b;
        
    }
}


please help me ...with out pageblck table excution is okay...but i want to display the a,b,c values on vf page ...how can i so??

thanks in advance

i created a wraper to display opp when selected from list...so here the prob is am getting this error even if call the method ....am getting this error.. Unknown property 'wraperforopp.prosses

Here is my vf page and class


VF page:

<apex:page controller="wraperforopp" >
<apex:form >
<apex:pageBlock >
<apex:pageBlockButtons >
<apex:commandButton value="{!prosses}" title="Click here"/>
</apex:pageBlockButtons>
<apex:pageblockSection title="All Accounts" collapsible="false" columns="2">
<apex:pageBlockTable value="{!oppertunitycrete}" var="o">
<apex:column >
<apex:inputCheckbox value="{!o.Selected}"/>
</apex:column>
<apex:column value="{!o.opp.name}" title="OPP Name"/>
<apex:column value="{!o.opp.Amount}"/>
</apex:pageBlockTable>
<apex:pageBlockTable value="{!createinnew}" var="h">
<apex:column value="{!h.name}"/>
<apex:column value="{!h.Amount}"/>
</apex:pageBlockTable>
</apex:pageblockSection>
</apex:pageBlock>

</apex:form>

</apex:page>


My class:

public class wraperforopp {

    


 public List<wraperopp> oppertunitycrete{get;set;}
 public List<opportunity> createinnew{get;set;}
 
 
 Public wraperforopp(){
 if(oppertunitycrete==null){
 oppertunitycrete=New List<wraperopp>();
 for(opportunity o:[select id,name,Amount from opportunity limit 10]){
 oppertunitycrete.add(new wraperopp(o) );
 }
 }
 }
 

    public void prosses(){
    createinnew=New List<opportunity>();
    for(wraperopp wraperoppobj:oppertunitycrete){
    if(wraperoppobj.Selected==true){
    createinnew.add(wraperoppobj.opp);
      }
     }
  }
 
 
 public class wraperopp{
 public opportunity opp{get;set;}
 public Boolean Selected{get;set;}
 
 public wraperopp(opportunity op){
 opp=op;
 Selected=false;
 }
 }
}


this is my class and controller ...here even i called the prosses then also am getting this error :Unknown property 'wraperforopp.prosses

What to do...thanks in advance
How to Add Relation ship field Id to javascript Button...For Example:  Account Address(Account_Address__c) Object. In this object i have a Account__C( field) value Which has a Master Detail Relation ship with Account. 


Now created a Javascript Button on Account_Address__C detail page . nOw my requirement is i have to send Account_Address_Id  and Account__c.Id Through this button ...How can i do that Please help me ...i ried the below code

Button:


{!REQUIRESCRIPT("/soap/ajax/30.0/connection.js")} 
{!REQUIRESCRIPT("/soap/ajax/30.0/apex.js")} 
//alert('hi'); 
if('{!Account_Address__c.Id}'!= null) 

alert('Do You Want To Create A SAP Account'); 
var AcctAddressID='{!Account_Address__c.Id}';
Var AccountID='{!Account_Address__c.Account__c.ID}' 
sforce.apex.execute("Bandvidth CreateUpdateSAPAccountAddress","createupdateSAPAccountAddress",{AcctAddressID:"{!Account_Address__c.Id}",{AccountID:"{!Account_Address__c.Account__c.ID}}); 
}


Am getting below Error while saving the button:

Error: Field Account_Address__c.Account__c.ID does not exist. Check spelling.


Please help me..thanks








 
I created a javascript button and passing Account ID and calling apex classes .When i click on button on account detail page am getting the Error when i press that button like  "A Problem with this button or link was Encountered       Unexpected Identifier"  


Button:


{!REQUIRESCRIPT("/soap/ajax/30.0/connection.js")} 
{!REQUIRESCRIPT("/soap/ajax/30.0/apex.js")} 

if({!Account.Name}!=Null) 

sforce.apex.execute("SandvineCreateUpdateSAPAccount","createupdateSAPAccount",{!Account.Id}"}); 
alert("This is {!Account.Name}"); 
}



Why am getting this error ...this button send the account ID to the external URL
Here am writing the parent -child query ...account parent and Entitlement is child...why it is not working..

select id,name,(select Entitlement.name,Entitlement.Status from entitlement) from account



Help me in this ...thanks in advance...
How to provide an account id to external system like(3rd party) using javascript button on account detail page....any examples or code?....here i will use the Rest Api

When i click on that button of account detail page  then then third partys object like customer record should create...Using REst Api

Help me ...thanks in advance





 
i created example vf page but <apex:pagemassages is not working in that> 

MY VF PAge: 

<apex:page controller="Mysecond" sidebar="false" >

<apex:form >
<apex:pageMessages ></apex:pageMessages>

<apex:pageBlock title="Create New Account">
<apex:pageblockButtons >
   <apex:commandButton action="{!resave}" value="Save" reRender="THe"/>
</apex:pageblockButtons>
  <apex:pageBlockSection Title="Account Information">
  <apex:inputField id="THE" value="{!Account.Name}"/>
  <apex:inputField id="IDS" value="{!Account.Phone}"/>
  </apex:pageBlockSection>
  <apex:pageblockTable value="{!tabledispaly}" var="t" id="THe">
  <!--<apex:column>
  <apex:inputCheckbox value="{!t.selected}"/>
  </apex:column>-->
  <apex:column value="{!t.Name}"/>
  <apex:column value="{!t.Phone}"/>
  </apex:pageblockTable>
  
</apex:pageBlock>
</apex:form>

</apex:page>


Controller:

public with sharing class Mysecond {

LIst<Account>tabledispaly= New LIst<Account>();
 Account account;
 
 
      public List<Account>gettabledispaly(){
      tabledispaly=[select id,name,phone from account];
      return tabledispaly;
      }
 
 public Account getAccount(){
 if(Account==null)
 account=New account();
 return account;
 }
 
 public void resave(){
 insert account;
   ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.ERROR,'Saved Successfully'));
 
 //THis to send the user to detail page for new account
   // PageReference acctPage = new ApexPages.StandardController(account).view();
    //acctPage.setRedirect(False);
     // return acctPage;
 }
 
 
}


What can be the problem...THanks in advance:




 
i created a wraper to display opp when selected from list...so here the prob is am getting this error even if call the method ....am getting this error.. Unknown property 'wraperforopp.prosses

Here is my vf page and class


VF page:

<apex:page controller="wraperforopp" >
<apex:form >
<apex:pageBlock >
<apex:pageBlockButtons >
<apex:commandButton value="{!prosses}" title="Click here"/>
</apex:pageBlockButtons>
<apex:pageblockSection title="All Accounts" collapsible="false" columns="2">
<apex:pageBlockTable value="{!oppertunitycrete}" var="o">
<apex:column >
<apex:inputCheckbox value="{!o.Selected}"/>
</apex:column>
<apex:column value="{!o.opp.name}" title="OPP Name"/>
<apex:column value="{!o.opp.Amount}"/>
</apex:pageBlockTable>
<apex:pageBlockTable value="{!createinnew}" var="h">
<apex:column value="{!h.name}"/>
<apex:column value="{!h.Amount}"/>
</apex:pageBlockTable>
</apex:pageblockSection>
</apex:pageBlock>

</apex:form>

</apex:page>


My class:

public class wraperforopp {

    


 public List<wraperopp> oppertunitycrete{get;set;}
 public List<opportunity> createinnew{get;set;}
 
 
 Public wraperforopp(){
 if(oppertunitycrete==null){
 oppertunitycrete=New List<wraperopp>();
 for(opportunity o:[select id,name,Amount from opportunity limit 10]){
 oppertunitycrete.add(new wraperopp(o) );
 }
 }
 }
 

    public void prosses(){
    createinnew=New List<opportunity>();
    for(wraperopp wraperoppobj:oppertunitycrete){
    if(wraperoppobj.Selected==true){
    createinnew.add(wraperoppobj.opp);
      }
     }
  }
 
 
 public class wraperopp{
 public opportunity opp{get;set;}
 public Boolean Selected{get;set;}
 
 public wraperopp(opportunity op){
 opp=op;
 Selected=false;
 }
 }
}


this is my class and controller ...here even i called the prosses then also am getting this error :Unknown property 'wraperforopp.prosses

What to do...thanks in advance
My class

global with sharing class CampaignTaskMerge{


    private final Account_Campaign__c acr;
    public id contactId     {get;set;}
    public CampaignTaskMerge (ApexPages.StandardController controller) {

   
        this.acr = (Account_Campaign__c)controller.getRecord();
        contactId = Apexpages.currentPage().getParameters().get('id');
    }
   
    public List<Task> acrs {
        get {
            {
                acrs = [Select Id, Campaign_ID__c, Task_Type__c, OwnerID, Task_Response__c, status, AccountID
                    From Task
                  where Campaign_ID__c = :ApexPages.currentPage().getParameters().get('id') and Task_Response__c = ''
                    ];               
            }
            return acrs;
        }
        private set;
    }
        public List<Task> acrsf {
        get {
            {
                acrsf = [Select Id, Campaign_ID__c, Task_Type__c, OwnerID, Task_Response__c, status, AccountID
                    From Task
                  where Campaign_ID__c = :ApexPages.currentPage().getParameters().get('id') and Task_Response__c = 'Failure'
                    ];               
            }
            return acrsf;
        }
        private set;
    }
            public List<Task> acrss {
        get {
            {
                acrss = [Select Id, Campaign_ID__c, Task_Type__c, OwnerID, Task_Response__c, status, AccountID
                    From Task
                  where Campaign_ID__c = :ApexPages.currentPage().getParameters().get('id') and Task_Response__c = 'Success'
                    ];               
            }
            return acrss;
        }
        private set;
    }



}



my testclass

@isTest
private class TestaskmergeClass{
    @isTest
    private static void testClass()
    {
    //Standard controller of Accountcontactrole
    //Create a new instance of Accountcontactrole
    Account acc = new Account(Name = 'Test Account');
    insert acc;
    Contact con = new Contact(LastName = 'Test Last Name', AccountId = acc.Id);
    insert con;
  Account_Campaign__c acr1 = new Account_Campaign__c();
         acr1.name='Test2';
     insert acr1;
 
    //Insert the object virtually


    //Create a new instance of standard controller
    ApexPages.StandardController sc = new ApexPages.standardController(acr1);

   Account_Campaign__c controller = new Account_Campaign__c(sc);
   
    List<Task>  acrsTest = controller.acrs;
    List<Task>  acrsfTest = controller.acrsf;
    List<Task>  acrssTest = controller.acrss;
  
    }
}



am getting this error while saving the test class Error: Compile Error: SObject constructor must use name=value pairs at line 22 column 37
My class

public with sharing class AccountContactRoles {
    private final Contact acr;
 
    public AccountContactRoles(ApexPages.StandardController controller){
        this.acr = (Contact)controller.getRecord();
    }
 
    public List<AccountContactRole> acrs {
        get {
            if (acrs == null) {
                acrs = [Select Id, AccountId, ContactId, Role, IsPrimary From AccountContactRole
                    Where ContactId=:acr.Id];             
            }
            return acrs;
        }
        private set;
    }
}


my Test class

@isTest
private class TestAccountcontactroleClass{
    @isTest
    private static void testClass()
    {
    //Standard controller of Accountcontactrole
    //Create a new instance of Accountcontactrole
    Account acc = new Account(Name = 'Test Account');
    insert acc;
    Contact con = new Contact(LastName = 'Test Last Name', AccountId = acc.Id);
    insert con;
 
    AccountContactRole acr1 = new AccountContactRole();
                acr1.AccountId = acc.Id;
                acr1.ContactId = con.Id;
                acr1.Role = 'Test 1';
                acr1.IsPrimary=True;
            insert acr1;
    //Insert the object virtually


    //Create a new instance of standard controller
    ApexPages.StandardController sc = new ApexPages.standardController(con);

    AccountContactRoles controller = new AccountContactRoles(sc); 
    }
}




Here the problem is am getting only 57% code coverage ...so iwant to cover the below lines in test class...how to write a methosd in test class to cover those lines...the uncoverd  lines in my test class from class is  

public List<AccountContactRole> acrs {
        get {
            if (acrs == null) {
                acrs = [Select Id, AccountId, ContactId, Role, IsPrimary From AccountContactRole



The above class line is not coverd in my test class...ple help me ...thanks  in advance
My class

public with sharing class AccountContactRoles {
    private final Contact acr;
  
    public AccountContactRoles(ApexPages.StandardController controller){
        this.acr = (Contact)controller.getRecord();
    }
  
    public List<AccountContactRole> acrs {
        get {
            if (acrs == null) {
                acrs = [Select Id, AccountId, ContactId, Role, IsPrimary From AccountContactRole
                    Where ContactId=:acr.Id];              
            }
            return acrs;
        }
        private set;
    }
}


my Test class

@isTest
private class TestAccountcontactroleClass{
    @isTest
    private static void testClass()
    {
    //Standard controller of Accountcontactrole
    //Create a new instance of Accountcontactrole
    Account acc = new Account(Name = 'Test Account');
    insert acc;
    Contact con = new Contact(LastName = 'Test Last Name', AccountId = acc.Id);
    insert con;
  
    AccountContactRole acr1 = new AccountContactRole();
                acr1.AccountId = acc.Id;
                acr1.ContactId = con.Id;
                acr1.Role = 'Test 1';
                acr1.IsPrimary=True;
            insert acr1;
    //Insert the object virtually
 

    //Create a new instance of standard controller
    ApexPages.StandardController sc = new ApexPages.standardController(con);

    AccountContactRoles controller = new AccountContactRoles(sc);  
    }
}





Am getting the code coverage of 57% only...how to increase my code covrage for this class....Thanks in advance
I wrote a test class for the following class ...but while saving am getting this error Whats wrong in my code...thanks



Error Error: Compile Error: Invalid constructor syntax, name=value pairs can only be used for SObjects at line 8 column 32


my test class


@isTest
private class TestAccountcontactroleClass{
    @isTest
    private static void testClass()
    {
    //Standard controller of Accountcontactrole
    //Create a new instance of Accountcontactrole
    AccountContactRole  accs = new AccountContactRole(Account.Name = 'TestAccountName',Role='Newrole',IsPrimary='True' );

    //Insert the object virtually
    insert accs;

    //Create a new instance of standard controller
    ApexPages.StandardController sc = new ApexPages.standardController(accs);

    AccountContactRoles controller = new AccountContactRoles(sc);
    }
}



My class


public with sharing class AccountContactRoles {
    private final Contact acr;
   
    public AccountContactRoles(ApexPages.StandardController controller){
        this.acr = (Contact)controller.getRecord();
    }
   
    public List<AccountContactRole> acrs {
        get {
            if (acrs == null) {
                acrs = [Select Id, Account.Name,
                     Role, IsPrimary
                    From AccountContactRole
                    Where ContactId=:acr.Id
                    ];               
            }
            return acrs;
        }
        private set;
    }
}




I need help ...thanks in advance
i have written this trigger to create opportunity once we create the account on account object
i have written this trigger to create  opportunity once we create the account  on account object if    account.create opportunity=true ..what i mean is there is a check box field in account ...if that is equls true then only opptunity should get created ..here is the code


trigger Opportunitycreate on Account (after insert) {
    List<opportunity>Listopp = New List<opportunity>();
    for(account acc:trigger.new){
       if(acc.Create_Contact__c==True){
        Opportunity opp = New opportunity();
        opp.account.name = acc.name;
        opp.name=acc.name;
        opp.CloseDate=date.Today();
        opp.StageName='Prospecting';
        Listopp.add(opp);
       }
       }
    if(Listopp.size()>0)
    insert Listopp;
}

am getting error while adding record in accounts objcet ...the error is in line 6...
help me please..thanks in advance.

User-added image