• Oron Mizrachi
  • NEWBIE
  • 20 Points
  • Member since 2015

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 5
    Questions
  • 10
    Replies
the Inline Editing doesn't work in the pageBlockTable (editable but doesn't update changes).

my suspicions its related to the need to update controller object from sql query running on costume object.

buy i don't know how to solve it , because its the best method to get this specific data. Any ideas?

Thank you.

Visualforce Page
<apex:page showHeader="false" sidebar="false" standardController="ACCOUNT"  extensions="BackStationsController">
 <apex:form >

 <apex:pageBlock title="Room Deatels" >

<apex:pageBlockButtons location="bottom">

   <apex:commandButton action="{!save}" id="saveButton" value="Save" rendered="true"/>
  </apex:pageBlockButtons>
  <apex:pageMessages /> 

  <apex:pageBlockSection columns="1"  title="Room Guests List" rendered="TRUE" collapsible="false">

    <apex:pageBlockTable value="{!constroom}" var="croom"  rows="5">
     <apex:inlineEditSupport event="ondblclick"   changedStyleClass="myBoldClass" resetFunction="resetInlineEdit"/> 


       <apex:column headerValue="Local ID" value="{!croom.PasiveAccount__r.Local_ID__c}"/>
      <apex:column headerValue="First Name" value="{!croom.PasiveAccount__r.firstname}"/>
      <apex:column headerValue="Last Name" value="{!croom.PasiveAccount__r.lastname}"/>
      <apex:column headerValue="Email" value="{!croom.PasiveAccount__r.PersonEmail}"/>
       <apex:column headerValue="Phone" value="{!croom.PasiveAccount__r.phone}"/>


    </apex:pageBlockTable>
  </apex:pageBlockSection>

     </apex:outputPanel>
             </apex:pageBlock>


</apex:form>

Extension
public with sharing class BackStationsController {



  public BackStationsController(ApexPages.StandardController std) {
     stdCtrl=std;
     integer  Tempcount = [Select Count() from UnitCloneJunc__c where ActiveAccount__r.id =:stdCtrl.getId()];
     if (stdCtrl.getId() != NULL && temp >0 )
        setupRoomchange();
}


private ApexPages.StandardController stdCtrl {get; set;}
public List<UnitCloneJunc__c> constroom {get; set;} 


Private void setupRoomchange(){
   constroom=[select  ID,PasiveAccount__r.phone, PasiveAccount__r.firstname, PasiveAccount__r.lastname,PasiveAccount__r.PersonEmail,PasiveAccount__r.Local_ID__c from UnitCloneJunc__c where id != null and ActiveAccount__r.isPersonAccount = true and ActiveAccount__r.id =:stdCtrl.getId() order by CreatedDate ASC];
  }

 
Hi i have a simple Apex Class , the only used as a controller for a visulforce page , and contain mainly soql jobs, 

But i just cant pass 72% covarge , no matter what Test in writing, 

the code below , can please some one help me with the Test class

Thank you.
public class PrivareaApex
{
 private ApexPages.StandardController stdCtrl {get; set;}
  
 public List<account> conts {get; set;}
  public string  currentRecordId {get;set;}
  public integer  Pax {get;set;}
public List<Invoice1__c> Invo {get; set;}

 public PrivareaApex(ApexPages.StandardController std)
 {

  stdCtrl=std;
  setupContacts();
 }
  
 private void setupContacts()
 {

 String Roomname=[select Unit_Name__c from account where Id=:stdCtrl.getId()].Unit_Name__c;
  conts=[select id, Name, PersonEmail, Phone, Union_Member_contact__pc from account where Unit_Name__c=:Roomname];
  Pax=[select COUNT() from account where Unit_Name__c=:Roomname];
  Invo = [select Name, Invoice_Date__c, Billed_Amount_NIS__c, Payment_Method__c,Billing_Frequency__c from Invoice1__c where Account__c=:stdCtrl.getId()];


 }
    
          }

 
hello i worte an apex trigger code, which update custom fields in oppertunity object, with the details of the primary contactrole,

the code works fine , but i cant deploy it cause i just dont know how to builed an apex test , 

could someone help me with that.

the code:

trigger PrimaryContactRole on Opportunity (before update) {

List<String> names = new List<String>();

   for (Opportunity o : Trigger.new) {
     Integer i = [select count() from OpportunityContactRole where OpportunityId = :o.id and IsPrimary = true];

        

       if(i==1) {

OpportunityContactRole contactRole = [select Contact.name,Contact.email,Contact.phone ,Contact.Passport_Num_contact__c,Contact.Local_ID_contact__c from OpportunityContactRole where OpportunityId = :o.id and IsPrimary = true];

 o.Opportunity_Contact_email__c = contactRole.Contact.email;
        
  o.Opportunity_Contact_name__c = contactRole.Contact.name;
  
  o.Opportunity_Contact_passport__c = contactRole.Contact.Passport_Num_contact__c;
 
  o.Opportunity_Contact_phone__c = contactRole.Contact.phone;

  o.Opportunity_Contact_localid__c = contactRole.Contact.Local_ID_contact__c;
   
   
   o.Contact_Role_Count__c = i;
   
  }

  }
thank you!
hi i have an apex trigger code that i dont know how to buuild a test for.

the code:


trigger PrimaryProduct on Opportunity (before update) {

list<opportunity> lt = trigger.new;

list<opportunityLineItem> opli = new list<opportunityLineItem>([select id ,product2.name, opportunityId,UnitPrice,Quantity from opportunitylineitem where opportunityId =: trigger.new[0].id]);

string productName='';
decimal salesprice='';
integer Quantity='';

for(opportunityLineItem o : opli){

 productName = o.product2.name;
  salesprice=o.UnitPrice;
   Quantity =o.Quantity;
}

for(Opportunity opp : trigger.new){

 opp.Opportunity_Prim_Product_Name__c = productName;
 opp.product_qunt__c=Quantity;
 opp.product_salesprice__c=salesprice;

}


}

can some one please help me building a test for it .

thanx
hi,

im trying setting an opportunity field with the name of a related product (there is always only one related product to each opportunity).

but , because im a new admin , im yet not fully control apex,

i though on trying OpportunityLineItems object (in an opportunity apex trigger) and form there get the connection 

but i couldn't find the right code for using the LineItems on Opportunity controller.
 
could some one help me with the code, its very important for us.

thnx

oron.


the Inline Editing doesn't work in the pageBlockTable (editable but doesn't update changes).

my suspicions its related to the need to update controller object from sql query running on costume object.

buy i don't know how to solve it , because its the best method to get this specific data. Any ideas?

Thank you.

Visualforce Page
<apex:page showHeader="false" sidebar="false" standardController="ACCOUNT"  extensions="BackStationsController">
 <apex:form >

 <apex:pageBlock title="Room Deatels" >

<apex:pageBlockButtons location="bottom">

   <apex:commandButton action="{!save}" id="saveButton" value="Save" rendered="true"/>
  </apex:pageBlockButtons>
  <apex:pageMessages /> 

  <apex:pageBlockSection columns="1"  title="Room Guests List" rendered="TRUE" collapsible="false">

    <apex:pageBlockTable value="{!constroom}" var="croom"  rows="5">
     <apex:inlineEditSupport event="ondblclick"   changedStyleClass="myBoldClass" resetFunction="resetInlineEdit"/> 


       <apex:column headerValue="Local ID" value="{!croom.PasiveAccount__r.Local_ID__c}"/>
      <apex:column headerValue="First Name" value="{!croom.PasiveAccount__r.firstname}"/>
      <apex:column headerValue="Last Name" value="{!croom.PasiveAccount__r.lastname}"/>
      <apex:column headerValue="Email" value="{!croom.PasiveAccount__r.PersonEmail}"/>
       <apex:column headerValue="Phone" value="{!croom.PasiveAccount__r.phone}"/>


    </apex:pageBlockTable>
  </apex:pageBlockSection>

     </apex:outputPanel>
             </apex:pageBlock>


</apex:form>

Extension
public with sharing class BackStationsController {



  public BackStationsController(ApexPages.StandardController std) {
     stdCtrl=std;
     integer  Tempcount = [Select Count() from UnitCloneJunc__c where ActiveAccount__r.id =:stdCtrl.getId()];
     if (stdCtrl.getId() != NULL && temp >0 )
        setupRoomchange();
}


private ApexPages.StandardController stdCtrl {get; set;}
public List<UnitCloneJunc__c> constroom {get; set;} 


Private void setupRoomchange(){
   constroom=[select  ID,PasiveAccount__r.phone, PasiveAccount__r.firstname, PasiveAccount__r.lastname,PasiveAccount__r.PersonEmail,PasiveAccount__r.Local_ID__c from UnitCloneJunc__c where id != null and ActiveAccount__r.isPersonAccount = true and ActiveAccount__r.id =:stdCtrl.getId() order by CreatedDate ASC];
  }

 
Hi i have a simple Apex Class , the only used as a controller for a visulforce page , and contain mainly soql jobs, 

But i just cant pass 72% covarge , no matter what Test in writing, 

the code below , can please some one help me with the Test class

Thank you.
public class PrivareaApex
{
 private ApexPages.StandardController stdCtrl {get; set;}
  
 public List<account> conts {get; set;}
  public string  currentRecordId {get;set;}
  public integer  Pax {get;set;}
public List<Invoice1__c> Invo {get; set;}

 public PrivareaApex(ApexPages.StandardController std)
 {

  stdCtrl=std;
  setupContacts();
 }
  
 private void setupContacts()
 {

 String Roomname=[select Unit_Name__c from account where Id=:stdCtrl.getId()].Unit_Name__c;
  conts=[select id, Name, PersonEmail, Phone, Union_Member_contact__pc from account where Unit_Name__c=:Roomname];
  Pax=[select COUNT() from account where Unit_Name__c=:Roomname];
  Invo = [select Name, Invoice_Date__c, Billed_Amount_NIS__c, Payment_Method__c,Billing_Frequency__c from Invoice1__c where Account__c=:stdCtrl.getId()];


 }
    
          }

 
hi i have an apex trigger code that i dont know how to buuild a test for.

the code:


trigger PrimaryProduct on Opportunity (before update) {

list<opportunity> lt = trigger.new;

list<opportunityLineItem> opli = new list<opportunityLineItem>([select id ,product2.name, opportunityId,UnitPrice,Quantity from opportunitylineitem where opportunityId =: trigger.new[0].id]);

string productName='';
decimal salesprice='';
integer Quantity='';

for(opportunityLineItem o : opli){

 productName = o.product2.name;
  salesprice=o.UnitPrice;
   Quantity =o.Quantity;
}

for(Opportunity opp : trigger.new){

 opp.Opportunity_Prim_Product_Name__c = productName;
 opp.product_qunt__c=Quantity;
 opp.product_salesprice__c=salesprice;

}


}

can some one please help me building a test for it .

thanx
hi,

im trying setting an opportunity field with the name of a related product (there is always only one related product to each opportunity).

but , because im a new admin , im yet not fully control apex,

i though on trying OpportunityLineItems object (in an opportunity apex trigger) and form there get the connection 

but i couldn't find the right code for using the LineItems on Opportunity controller.
 
could some one help me with the code, its very important for us.

thnx

oron.