• Abhiman Mungal
  • NEWBIE
  • 20 Points
  • Member since 2018

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 6
    Questions
  • 10
    Replies
i want email tamplate which is for Booked event 
when customer Booked event for any Event organizer that time send email to that customer from that organizer 
i have lots of organizer and customer account in my salesforce org
<apex:page standardController="Profile__c" extensions="OrdersFromUsers">
 <apex:outputPanel id="all">
  <apex:form >
    <apex:pageBlock >
      <apex:pageBlockSection title="Orders" columns="1" >
        <apex:pageBlockTable value="{!OrdersFromUsers}" var="cont">
          <apex:column value="{!cont.Name}"/>
           <apex:column value="{!cont.Address__c}"/>
         <apex:column value="{!cont.Booking_Date__c}"/>
          <apex:column value="{!cont.Customer_Name__c}" />
          <apex:column value="{!cont.Event_Name__c}" />
          <apex:column value="{!cont.Event_Type__c}"/>
       <!--   <apex:column value="{!cont.Location__c}"/>-->
          <apex:column value="{!cont.Services__c}"/>
           <apex:column value="{!cont.Time__c}"/>
        </apex:pageBlockTable>
         </apex:pageBlockSection>
    </apex:pageBlock>
    
     <apex:pageBlock >
     
      <apex:pageBlockSection title="Customer Information" columns="1" id="info">
        <apex:pageBlockTable value="{!ViewCustomerDetail}" var="cust">
          
          <apex:column value="{!cust.Name}"/>
          <apex:column value="{!cust.Address__c}"/>
          <apex:column value="{!cust.District__c}"/>
          <apex:column value="{!cust.Email__c}" />
          <apex:column value="{!cust.Mobile_No__c}"/>
          <apex:column value="{!cust.Pin_Code__c}"/>
          <apex:column value="{!cust.State__c}"/>
         
        </apex:pageBlockTable>
      
      </apex:pageBlockSection>
    </apex:pageBlock>
  </apex:form>
 </apex:outputPanel>
</apex:page>


public with sharing class OrdersFromUsers {
     public List<Order__c> OrdersFromUsers{get; set;}
   public List<Profile__c> ViewCustomerDetail{get;set;}
   public String actualName;
    public OrdersFromUsers(ApexPages.StandardController controller) {
    
        List <Order__c> val=[select Customer_Name__c from Order__c where customerName__r.name=:UserInfo.getFirstName()+' '+UserInfo.getLastName()];
        for(integer i=0;i<val.size();i++)
        {
            actualName='%'+val[i].Customer_Name__c+'%';
            ViewCustomerDetail=[select name,Address__c,District__c,Email__c,Mobile_No__c,Pin_Code__c,State__c from Profile__c where name like:actualName];
            
        }
        actualName='';
       OrdersFromUsers=[select name,Address__c,Booking_Date__c,Customer_Name__c,Event_Name__c,Event_Type__c,Services__c,Time__c from Order__c where customerName__r.name=:UserInfo.getName()];
    }
 
}

if i do this its giving me last record of that list but i want all records from this list
so what can i do plz tell me....

User-added image
when i click on customer name that time i want to open that corresponding record detail in that particular object 
public with sharing class OrderApex {

public Order__c c{get; set;}

public String nameuser{get; set;}

public boolean show{get;set;}
public boolean Edit{get;set;}
public boolean save{get;set;}

 public OrderApex(ApexPages.StandardController controller) {
 c=new Order__c ();
 if(c==null)
 {
     save=true;
     show=false;
     Edit=false; 
 }
 else
 {
     nameuser=userInfo.getName();
     c.Customer_Name__c=nameuser;
     try
     {
     c=[select Name,Address__c,Booking_Date__c,Time__c,customerName__c,Customer_Name__c from Order__c limit 1];

 save=false;
 show=true;
 Edit=false; 
 }
 catch(Exception e) 
 { } 
 }
 }
 
 
 public pageReference save(){
 
 insert c;
  c.Customer_Name__c=nameuser;
 c=[select Name,Address__c,Booking_Date__c,Time__c,customerName__c from Order__c limit 1];
 
 show=true;
 save=false;
 
 return null;
 }
 
 public pageReference editData(){
 
 Edit=true;
 show=false;
 save=false;
 
 c=[select Name,Address__c,Booking_Date__c,Time__c,customerName__c from Order__c limit 1];
 
 
 return null;
 }
 
 public pageReference editAfterSave(){
 upsert c;
 
 c=[select Name,Address__c,Booking_Date__c,Time__c,customerName__c from Order__c where Customer_Name__c=:nameuser limit 1];

 Edit=false;
 show=true;
 save=false;
  
 return null;
 }
 
}


<apex:page standardcontroller="Order__c" extensions="OrderApex" sidebar="false" >
 <apex:form >
 <apex:pageBlock rendered="{!save}" title="Save Profile">
 <apex:pageblockSection >
 
 <apex:inputField value="{!c.Name}"/>
 <apex:inputField value="{!c.Address__c}"/>
 <apex:inputField value="{!c.Booking_Date__c}"/>
 <apex:inputField value="{!c.Time__c}"/>
 <apex:inputField value="{!c.customerName__c}"/>
 <apex:inputField value="{!c.Customer_Name__c}"/>
 
 <apex:commandButton action="{!save}" value="SaveData"/>
 </apex:pageblockSection>
 </apex:pageBlock>

 <apex:pageBlock rendered="{!show}" title="Show Profile">
 <apex:pageblockSection >

 <apex:outputText value="{!c.Name}"/>
 <apex:outputText value="{!c.Address__c}"/>
 <apex:outputText value="{!c.Booking_Date__c}"/>
 <apex:outputText value="{!c.Time__c}"/>
 <apex:outputText value="{!c.customerName__c}"/>
 <apex:outputText value="{!c.Customer_Name__c}"/>
   
 <apex:commandButton action="{!editData}" value="Edit"/>
 </apex:pageblockSection>
 </apex:pageBlock>

 <apex:pageBlock rendered="{!Edit}" title="Edit Profile">
 <apex:pageblockSection >
 
 
 <apex:inputField value="{!c.Name}"/>
 <apex:inputField value="{!c.Address__c}"/>
 <apex:inputField value="{!c.Booking_Date__c}"/>

 <apex:inputField value="{!c.Time__c}"/>
 <apex:inputField value="{!c.customerName__c}"/>
 <apex:inputField value="{!c.Customer_Name__c}"/>
   
 
 <apex:commandButton action="{!editAfterSave}" value="save"/>
 </apex:pageblockSection>
 </apex:pageBlock>


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




when i try to run this code it will give me error like 


System.SObjectException: SObject row was retrieved via SOQL without querying the requested field: Order__c.Customer_Name__c 

what i have to do???
<apex:page standardController="Position__c" extensions="ParamBlogController">
 <apex:outputPanel id="all">
  <apex:form >
    <apex:pageBlock title="Account Detail">
      <apex:pageBlockSection title="Account">
            
             <apex:commandButton action="{!setupContacts}" value="try"/>
            <apex:inputField value="{!Position__c.Position_Type__c}"/>
     
      </apex:pageBlockSection>
      <apex:pageBlockSection title="Contacts" columns="1">
        <apex:pageBlockTable value="{!conts}" var="cont" rows="10">
          <apex:column value="{!cont.Id}"/>
          <apex:column value="{!cont.Name}"/>
           <apex:column value="{!cont.city_state__c}"/>
          <apex:column value="{!cont.Position_Type__c}"/>
          
      
        </apex:pageBlockTable>
      </apex:pageBlockSection>
    </apex:pageBlock>
  </apex:form>
 </apex:outputPanel>
</apex:page>


public class ParamBlogController 
{
 private ApexPages.StandardController stdCtrl {get; set;}
  
 public List<position__c> conts {get; set;}
  
 public ParamBlogController(ApexPages.StandardController std)
 {
  stdCtrl=std;
 
 }
  
 public void setupContacts()
 {
  conts=[select Name,city_state__c,Department__c,Position_Id__c,Position_Type__c from position__c where Position_Type__c=:stdCtrl.getId()];
 }
}

when i try to get the all records from position related records to position_types__c 
i try to run this query on ananomous window .it will give me some error like

Line: 1, Column: 20
Select Name,position_types__r.Name from position__c ^ ERROR at Row:1:Column:13 Didn't understand relationship 'position_types__r' in field path. If you are attempting to use a custom relationship, be sure to append the '__r' after the custom relationship name. Please reference your WSDL or the describe call for the appropriate names.

please give me some suggession on this
 
<apex:page standardController="Profile__c" extensions="OrdersFromUsers">
 <apex:outputPanel id="all">
  <apex:form >
    <apex:pageBlock >
      <apex:pageBlockSection title="Orders" columns="1" >
        <apex:pageBlockTable value="{!OrdersFromUsers}" var="cont">
          <apex:column value="{!cont.Name}"/>
           <apex:column value="{!cont.Address__c}"/>
         <apex:column value="{!cont.Booking_Date__c}"/>
          <apex:column value="{!cont.Customer_Name__c}" />
          <apex:column value="{!cont.Event_Name__c}" />
          <apex:column value="{!cont.Event_Type__c}"/>
       <!--   <apex:column value="{!cont.Location__c}"/>-->
          <apex:column value="{!cont.Services__c}"/>
           <apex:column value="{!cont.Time__c}"/>
        </apex:pageBlockTable>
         </apex:pageBlockSection>
    </apex:pageBlock>
    
     <apex:pageBlock >
     
      <apex:pageBlockSection title="Customer Information" columns="1" id="info">
        <apex:pageBlockTable value="{!ViewCustomerDetail}" var="cust">
          
          <apex:column value="{!cust.Name}"/>
          <apex:column value="{!cust.Address__c}"/>
          <apex:column value="{!cust.District__c}"/>
          <apex:column value="{!cust.Email__c}" />
          <apex:column value="{!cust.Mobile_No__c}"/>
          <apex:column value="{!cust.Pin_Code__c}"/>
          <apex:column value="{!cust.State__c}"/>
         
        </apex:pageBlockTable>
      
      </apex:pageBlockSection>
    </apex:pageBlock>
  </apex:form>
 </apex:outputPanel>
</apex:page>


public with sharing class OrdersFromUsers {
     public List<Order__c> OrdersFromUsers{get; set;}
   public List<Profile__c> ViewCustomerDetail{get;set;}
   public String actualName;
    public OrdersFromUsers(ApexPages.StandardController controller) {
    
        List <Order__c> val=[select Customer_Name__c from Order__c where customerName__r.name=:UserInfo.getFirstName()+' '+UserInfo.getLastName()];
        for(integer i=0;i<val.size();i++)
        {
            actualName='%'+val[i].Customer_Name__c+'%';
            ViewCustomerDetail=[select name,Address__c,District__c,Email__c,Mobile_No__c,Pin_Code__c,State__c from Profile__c where name like:actualName];
            
        }
        actualName='';
       OrdersFromUsers=[select name,Address__c,Booking_Date__c,Customer_Name__c,Event_Name__c,Event_Type__c,Services__c,Time__c from Order__c where customerName__r.name=:UserInfo.getName()];
    }
 
}

if i do this its giving me last record of that list but i want all records from this list
so what can i do plz tell me....

User-added image
when i click on customer name that time i want to open that corresponding record detail in that particular object 
public with sharing class OrderApex {

public Order__c c{get; set;}

public String nameuser{get; set;}

public boolean show{get;set;}
public boolean Edit{get;set;}
public boolean save{get;set;}

 public OrderApex(ApexPages.StandardController controller) {
 c=new Order__c ();
 if(c==null)
 {
     save=true;
     show=false;
     Edit=false; 
 }
 else
 {
     nameuser=userInfo.getName();
     c.Customer_Name__c=nameuser;
     try
     {
     c=[select Name,Address__c,Booking_Date__c,Time__c,customerName__c,Customer_Name__c from Order__c limit 1];

 save=false;
 show=true;
 Edit=false; 
 }
 catch(Exception e) 
 { } 
 }
 }
 
 
 public pageReference save(){
 
 insert c;
  c.Customer_Name__c=nameuser;
 c=[select Name,Address__c,Booking_Date__c,Time__c,customerName__c from Order__c limit 1];
 
 show=true;
 save=false;
 
 return null;
 }
 
 public pageReference editData(){
 
 Edit=true;
 show=false;
 save=false;
 
 c=[select Name,Address__c,Booking_Date__c,Time__c,customerName__c from Order__c limit 1];
 
 
 return null;
 }
 
 public pageReference editAfterSave(){
 upsert c;
 
 c=[select Name,Address__c,Booking_Date__c,Time__c,customerName__c from Order__c where Customer_Name__c=:nameuser limit 1];

 Edit=false;
 show=true;
 save=false;
  
 return null;
 }
 
}


<apex:page standardcontroller="Order__c" extensions="OrderApex" sidebar="false" >
 <apex:form >
 <apex:pageBlock rendered="{!save}" title="Save Profile">
 <apex:pageblockSection >
 
 <apex:inputField value="{!c.Name}"/>
 <apex:inputField value="{!c.Address__c}"/>
 <apex:inputField value="{!c.Booking_Date__c}"/>
 <apex:inputField value="{!c.Time__c}"/>
 <apex:inputField value="{!c.customerName__c}"/>
 <apex:inputField value="{!c.Customer_Name__c}"/>
 
 <apex:commandButton action="{!save}" value="SaveData"/>
 </apex:pageblockSection>
 </apex:pageBlock>

 <apex:pageBlock rendered="{!show}" title="Show Profile">
 <apex:pageblockSection >

 <apex:outputText value="{!c.Name}"/>
 <apex:outputText value="{!c.Address__c}"/>
 <apex:outputText value="{!c.Booking_Date__c}"/>
 <apex:outputText value="{!c.Time__c}"/>
 <apex:outputText value="{!c.customerName__c}"/>
 <apex:outputText value="{!c.Customer_Name__c}"/>
   
 <apex:commandButton action="{!editData}" value="Edit"/>
 </apex:pageblockSection>
 </apex:pageBlock>

 <apex:pageBlock rendered="{!Edit}" title="Edit Profile">
 <apex:pageblockSection >
 
 
 <apex:inputField value="{!c.Name}"/>
 <apex:inputField value="{!c.Address__c}"/>
 <apex:inputField value="{!c.Booking_Date__c}"/>

 <apex:inputField value="{!c.Time__c}"/>
 <apex:inputField value="{!c.customerName__c}"/>
 <apex:inputField value="{!c.Customer_Name__c}"/>
   
 
 <apex:commandButton action="{!editAfterSave}" value="save"/>
 </apex:pageblockSection>
 </apex:pageBlock>


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




when i try to run this code it will give me error like 


System.SObjectException: SObject row was retrieved via SOQL without querying the requested field: Order__c.Customer_Name__c 

what i have to do???
<apex:page standardController="Position__c" extensions="ParamBlogController">
 <apex:outputPanel id="all">
  <apex:form >
    <apex:pageBlock title="Account Detail">
      <apex:pageBlockSection title="Account">
            
             <apex:commandButton action="{!setupContacts}" value="try"/>
            <apex:inputField value="{!Position__c.Position_Type__c}"/>
     
      </apex:pageBlockSection>
      <apex:pageBlockSection title="Contacts" columns="1">
        <apex:pageBlockTable value="{!conts}" var="cont" rows="10">
          <apex:column value="{!cont.Id}"/>
          <apex:column value="{!cont.Name}"/>
           <apex:column value="{!cont.city_state__c}"/>
          <apex:column value="{!cont.Position_Type__c}"/>
          
      
        </apex:pageBlockTable>
      </apex:pageBlockSection>
    </apex:pageBlock>
  </apex:form>
 </apex:outputPanel>
</apex:page>


public class ParamBlogController 
{
 private ApexPages.StandardController stdCtrl {get; set;}
  
 public List<position__c> conts {get; set;}
  
 public ParamBlogController(ApexPages.StandardController std)
 {
  stdCtrl=std;
 
 }
  
 public void setupContacts()
 {
  conts=[select Name,city_state__c,Department__c,Position_Id__c,Position_Type__c from position__c where Position_Type__c=:stdCtrl.getId()];
 }
}

when i try to get the all records from position related records to position_types__c