• acrozier
  • NEWBIE
  • 35 Points
  • Member since 2010

  • Chatter
    Feed
  • 1
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 31
    Questions
  • 55
    Replies

How can I get the related AccountId from the Opportunity with Quote as my controller?

Hello,

 

I would like to send an email alert based on a workflow rule on a custom object.  when the condition is met I want an email to go out with a visualforce page as a pdf.  how can I do this?

How can I match a multi picklist to its related values.  For instance

 

Object= Locations

 

field= Locations__c

 

field value= Atlanta, GA; NY,NY(NYC)

 

I need to return fields from the Atlanta,GA and NY,NY(NYC) Locations

Hello,

 

I have a dynamic binding which generates the sum of a column using a SOQL query.  I want this some to be formatted and displayed for currency.  I can't use the param value of apex:outputext because the value is not populated until run time, so I am getting save errors.  I figure I need to format this in the class and then spit out my formatted value and call that as a dynamic binding, I just can't get it to work.  Can anyone help me figure out how to take this value and format it in this manor? 0, number, ###,###,##0.00

 

public SObject getsumIncentive(){
        SObject sumIncentive;
        sumIncentive = [SELECT SUM(Total__c) sum FROM AIIncentive__c WHERE Job__c =:jobid];
        return sumIncentive;
        }

 

Hello,

 

I need to do some calculations on cells in a datatable to generate sums, for instance, I have a QTY field and a Honoraria field.  I need to mutiply the value of the Honoraria field by the QTY field to give me my Total.  How can I do this in either Javascript or Apex?  Code examples below,

 

 

DataTable

<apex:dataTable id="incentives" cellpadding="4px" width="100%" frame="none" border="1" Value="{!Incents}" Var="I">
                <apex:column width="20%">
                    <apex:outputField value="{!I.QTY__c}"/>
                </apex:column>
                <apex:column width="60%">
                    <apex:outputField value="{!I.Description__c}"/>
                </apex:column>
                <apex:column width="20%">
                    <apex:outputField value="{!I.Honoraria__c}"/>
                </apex:column>
            </apex:dataTable>

 

Extension

 

public with sharing class Incent {
public list<AIIncentive__c> Incents {get; set;}
public list<job__c> job {get; set;}
public id jobid;
public string NewIncentive {get; set;}
public PageReference refresh = ApexPages.currentPage(); 

    public Incent(ApexPages.StandardController controller) {
    	
     	jobid = apexpages.currentpage().getParameters().get('id');
        system.debug('################################## Id'+jobid);

        Incents = [Select QTY__c, Description__c,  Honoraria__c, Job__c, Deleted__c  From AIIncentive__c  where Job__c = :jobid]; 
        
        job = [SELECT Account__c FROM Job__c WHERE id= :jobid];    
        
        }


    public PageReference NewIncentive(){
    	
    	AIIncentive__c obj = new AIIncentive__c();

          	obj.QTY__c = 0;
     		obj.Description__c = '';
     		obj.Honoraria__c = 0;
     		obj.Job__c = jobid;

	 	update Incents;
	 		 
     	insert obj;
     
        	refresh.setRedirect(true);
     
   	 	return refresh;
     
    }
    
    public PageReference save() {
        	        	
    	update Incents;
        
	        refresh.setRedirect(true);        

        return refresh;

    }
    
 
//    public PageReference SaveReturn() {
    	
    	
//    	update Incents;
    		
    	
//    	return 
    		
//    }
       
    
}

 

Hello,

 

I am trying to render datatables based on the values of two date fields matching, or not.  Below is the code I am trying to use, but it doesn't work.  Basically if the Start Date equals the End Date I want to populate one datatable and if not I want to populate the other.

 

<apex:dataTable rendered="{!IF(Job__c.Job_Start_Date__c == Job__c.Job_End_Date__c,true,false)}" style="font-family: Calibri, sans-serif; font-size: 12px" value="{!Job__c}" var="j" rowClasses="odd,even">
    
                    	<apex:column >
                        	<apex:outputtext value="{0,date,MM/dd/yyyy}">
                            	<apex:param value="{!j.Job_Start_Date__c}" />
                        	</apex:outputtext>
 -                 
                        	<apex:outputtext value="{0,date,MM/dd/yyyy}">
                            	<apex:param value="{!j.Job_End_Date__c}" />
                        	</apex:outputtext>
                    	</apex:column>
            
                	</apex:dataTable>            	
            	
                	<apex:dataTable rendered="{!IF(Job__c.Job_Start_Date__c = Job__c.Job_End_Date__c,true,false)}" style="font-family: Calibri, sans-serif; font-size: 12px" value="{!Job__c}" var="j" rowClasses="odd,even">
    
                    	<apex:column >
                        	<apex:outputtext value="{0,date,MM/dd/yyyy}">
                            	<apex:param value="{!j.Job_Start_Date__c}" />
                        	</apex:outputtext>                 
                        </apex:column>
                        	
                	</apex:dataTable>    

 

Hello,

 

I have a page that I am trying to get to renderAs PDF, but the page never loads.  When I use application/msword the document can be opened and everything appears to work.  Does someone see anything in the code below that would bomb out a PDF?

 

<apex:page standardController="Job__c" extensions="AdvIncentEXT,Incent" showHeader="false" renderAs="pdf"> 
<head>
<style type="text/css">
table 
    {
    page-break-inside: avoid;
    }
</style>
</head>
<center>

<body>
         <table align="center" style="font-face: arial sans-sarif; font-size:16px;">

         <tr>
            <td>
                <center><img src="http://www.schlesingerassociates.com/logos/logosmall.jpg"/></center>
            </td>
         </tr> 
        
        <tr align="center">
            <td>
                <u>Advance Incentive Invoice</u>
                
            </td>
        </tr>
        
       </table>
    
       
<br />
<br />
        <table style="font-family: Calibri, sans-serif; font-size: 12px" align="center" width="100%">
        
        <tr>
        
            <td width="10%">
                <strong>BILL TO:</strong>
            </td>
            <td width="35%">
                {!Job__c.Contact__r.MailingStreet}<br />
                {!Job__c.Contact__r.MailingCity},{!Job__c.Contact__r.MailingState},{!Job__c.Contact__r.MailingPostalCode}
            </td>
            <td width="50%">
                <table style="font-family: Calibri, sans-serif; font-size: 12px" border="1" width="100%">
                
                    <tr>
                        <td width="35%">
                            <strong>Invoice #</strong>        
                        </td>
                        <td width="65%">
                        
                        </td>
                    </tr>
                    <tr>
                        <td width="35%">
                            <strong>Invoice Date</strong>           
                        </td>
                        <td width="65%">
                        
                        </td>
                    </tr>
                    <tr>
                        <td width="35%">
                            <strong>PO #</strong>          
                        </td>
                        <td width="65%">
                        
                        </td>
                    </tr>
                    
                </table>
             </td>
        </tr>
        
        
        </table>


        <table style="font-family: Calibri, sans-serif; font-size: 12px" border="1" align="center" width="100%">

        <tr>
        
            <td bgcolor="#a0cf69">
                <strong>Research Date(s)</strong>
            </td>
            <td bgcolor="#a0cf69">
                <strong>Client Project #</strong>
            </td>
            <td bgcolor="#a0cf69">
                <strong>Project #</strong>
            </td>
            <td bgcolor="#a0cf69">
                <strong>Location</strong>
            </td>
            <td bgcolor="#a0cf69">
                <strong>Terms</strong>
            </td>
            <td bgcolor="#a0cf69">
                <strong>Tax ID</strong>
            </td>
          
        </tr>
        <tr height="50%">
        
            <td>
                <apex:dataTable style="font-family: Calibri, sans-serif; font-size: 12px" value="{!Job__c}" var="j" cellpadding="4" rowClasses="odd,even">
    
               		<apex:column >
                   		<apex:outputtext value="{0,date,MM/dd/yyyy}">
                        	<apex:param value="{!j.Job_Start_Date__c}" />
                   		</apex:outputtext>
 -                 
                   		<apex:outputtext value="{0,date,MM/dd/yyyy}">
                        	<apex:param value="{!j.Job_End_Date__c}" />
                   		</apex:outputtext>
               		</apex:column>
            
    			</apex:dataTable>    

            </td>
            <td>
                {!Job__c.Client_Ref__c} 
            </td>
            <td>
                {!Job__c.Name}    
            </td>
            <td>
                {!Job__c.Other_Location__c}   
            </td>
            <td>
                   
            </td>
            <td>
                    
            </td>
            
            
        </tr>
            
    
    </table>

<br />

    <apex:dataTable Value="{!Incents}" Var="I">
        <apex:column headerValue="QTY">
            <apex:outputField value="{!I.QTY__c}"/>
        </apex:column>
        <apex:column headerValue="Description">
            <apex:outputField value="{!I.Description__c}"/>
        </apex:column>
        <apex:column headerValue="Honoraria">
            <apex:outputField value="{!I.Honoraria__c}"/>
        </apex:column>
    </apex:dataTable> 
    
    
    
<br />
<br />
    <table align="center" style="font-family: Calibri, sans-serif; font-size: 12px" width="100%">
    
        <tr>
            <td align="center">
                {!LocAddr}<br />
                <strong>Phone:</strong> {!LocPhone} <strong>Fax:</strong> {!LocFax} <strong>Toll Free</strong> {!LocTollFree} <strong>E-Mail</strong> {!UserEmail}
                 <a href="http://www.schlesingerassociates.com">http://www.SchlesingerAssociates.com</a>
            </td>                
        </tr>
       
    </table> 
    
    <table align="center" style="font-family: Calibri, sans-serif; font-style: italic; font-size: 12px" border="1" width="100%"> 
    
        <tr>
            <td align="center">
               <img src="http://www.schlesingerassociates.com/logos/cc.jpg" /><br />If paying by credit card a 4% service charge is added to the balance.  If you wish to pay via credit card, please contact Anna Schultz at 732-906-1122 or vis e-mail at anna@schlesingerassociates.com for a Credit Card Authorization Form.                       
            </td>
            
        </tr>    
      
        <tr>
            <td>
               <center>
                www.SchlesingerAssociates.com  Toll free in the US: 866-549-3500<br></br>
                US:  Atlanta  Boston  Chicago/Downtown  Chicago/O Hare  Dallas  Houston  Los Angeles  New Jersey  New York  Orlando  Philadelphia/Center City  Philadelphia/Bala
                Cynwyd  Phoenix  San Francisco<br></br>
                UK:  Central London  Wimbledon
               </center>
            </td>
        </tr>
          
    </table>
    
    <table align="center">
        
        <tr>
            <td>
                - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  
            </td>
        </tr>
        <tr>
            <td>
                
            </td>
        </tr>
        
    </table>
    
    <center style="font-family: Calibri, sans-serif; font-size: 12px"><strong>REMITTANCE</strong> - PLEASE SEND TO THE ADDRESS ABOVE:</center>
    
    <table style="font-family: Calibri, sans-serif; font-size: 12px" align="center" border="1" width="80%">
    
        <tr>
            <td>
                <strong>Invoice #</strong>
            </td>
            <td>
                - Please include this number on your check.
            </td>
        </tr>
        <tr>
            <td>
               <strong>Client</strong>
            </td>
            <td>
                {!Job__c.Account__c}
            </td>
        </tr>
        <tr>
            <td>
                <strong>Date</strong>
            </td>
            <td>
            
            </td>
        </tr>  
        <tr>
            <td>
                <strong>Amount Enclosed</strong>
            </td>
            <td>
            
            </td>
        </tr>
        
    </table>    

           
</body>                 
</center>

</apex:page>

 

Hello,

 

I am trying to create a save and return button for my custom edit page and I am struggling to get a page reference that will return the user to the previous page.  What method do I use to return the Previous Page?

Hello,

 

I have a two custom objects with a master detail relationship with Job__c being the master and AIIncentive__c the detail.  The AIIncentive__c object is displayed as a related list on my Job__c object. I created a custom edit page to be used off of the job page so that when a user goes to add a new line or edit other lines they will see a list of AIIncentive__c  data related to the Job__c object they are on.  

 

The problem that I am having is that I need the buttons that appear at the top of the related list to redirect the user to this custom edit page instead of the default New AIIncentive page.  I set the edit buttons to redirect to this page and that works, but when I set the New button to go to this page I get the following error.

 

Visualforce Error


System.QueryException: List has no rows for assignment to SObject
Class.Incent.: line 11, column 1

 

I can't seem to add a custom button to the top of the related list either, it will only let me add the New button, which will not redirect correctly.

 

VF page

<apex:page standardController="AIIncentive__c" extensions="Incent">
<apex:form >
<apex:pageBlock title="Edit Incentives">
		<apex:pageBlockButtons >   
         <apex:commandButton value="Save" action="{!save}" reRender="incentpanel"/> 
         <apex:commandButton value="New" action="{!NewIncentive}" reRender="incentpanel"/>
		</apex:pageBlockButtons>
             
      
     	<apex:pageblockSection >
         <apex:dataTable value="{!job}" var="j" cellspacing="5">
             <apex:column >
                 <strong>Account:</strong> &nbsp; <apex:outputField value="{!j.Account__c}"/>
             </apex:column><br />
             <apex:column >
                 <strong>Job Number:</strong> &nbsp; <apex:outputField value="{!AIIncentive__c.Job__c}"/>
             </apex:column>
         </apex:datatable><br />
        </apex:pageblockSection>
     
 
   
       
     <apex:pageblockTable value="{!Incents}" var="incent" id="incentpanel">
             <apex:column headerValue="QTY">
                 <apex:inputField value="{!incent.QTY__c}"/>
             </apex:column>
             <apex:column headerValue="Description">
                 <apex:inputField value="{!incent.Description__c}"/>
             </apex:column>
             <apex:column headerValue="Honoraria__c">
                 <apex:inputField value="{!incent.Honoraria__c}"/>
             </apex:column>
             <apex:column headerValue="Deleted">
                 <apex:inputField Value="{!incent.Deleted__c}"/>
             </apex:column>
         </apex:pageblockTable>

         
     
       
       
    </apex:pageBlock>

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

 Extension

public with sharing class Incent {
public list<AIIncentive__c> Incents {get; set;}
public list<job__c> job {get; set;}
public id jobid;
public string NewIncentive {get; set;}
public PageReference refresh = ApexPages.currentPage();


    public Incent(ApexPages.StandardController controller) {
     id incentId= apexpages.currentpage().getParameters().get('id');
        jobid=[select id, Job__c from AIIncentive__c where id=:incentId].Job__c;

        Incents = [Select QTY__c, Description__c,  Honoraria__c, Job__c, Deleted__c  From AIIncentive__c  where Job__c = :jobid]; 
        job = [SELECT Account__c FROM Job__c WHERE id= :jobid];    
        }


    
    public PageReference NewIncentive(){
    	
    	    	    	
    	AIIncentive__c obj = new AIIncentive__c();
          	obj.QTY__c = 0;
     		obj.Description__c = '';
     		obj.Honoraria__c = 0;
     		obj.Job__c = jobid;

	 update Incents;
	 		 
     insert obj;
     
        refresh.setRedirect(true);
     
   	 return refresh;
     
    }
    
        public PageReference save() {
        	        	
        update Incents;
        
        	refresh.setRedirect(true);
        	        
        return refresh;
    }
    
    
 //   public PageReference Button(){

 //    NewIncentive();
    
   



//      return true;
     
 //    }
    }

 

Hello,

 

I have a custom edit page for a custom object which is doing almost everything that I need it to do.  The final piece is to save all the records on the current page before returning a new value.  Currently when you click the New button the new row will be added but will not retain changes made to the other rows.  Both my Visualforce and Controller are below:

 

Controller

 

public with sharing class Incent {
public list<AIIncentive__c> Incents {get; set;}
public list<job__c> job {get; set;}
public id jobid;
public string Button {get; set;}
    public Incent(ApexPages.StandardController controller) {
     id incentId= apexpages.currentpage().getParameters().get('id');
        jobid=[select id, Job__c from AIIncentive__c where id=:incentId].Job__c;

        Incents = [Select QTY__c, Description__c,  Honoraria__c, Job__c, Deleted__c  From AIIncentive__c  where Job__c = :jobid]; 
        job = [SELECT Account__c FROM Job__c WHERE id= :jobid];    
        }
      
      
    public PageReference Button(){

     AIIncentive__c obj = new AIIncentive__c();
     
     obj.QTY__c = 0;
     obj.Description__c = '';
     obj.Honoraria__c = 0;
     obj.Job__c = jobid;


    insert obj;
    
    PageReference acctPage = ApexPages.currentpage();
    

      acctPage.setRedirect(true);



      return acctPage;
     
     }
    }

 

Visualforce

 

<apex:page standardController="AIIncentive__c" extensions="Incent">
    <apex:form >
     <apex:pageBlock title="Edit Incentives">
     
         <apex:commandButton value="Save & Return" action="{!save}"/> 
         <apex:commandButton value="New" action="{!Button}">
             <apex:actionSupport event="onclick" rerender="incenttable" status="refreshstatus"/>
             <apex:actionStatus id="refreshstatus" startstyle="color:green;" startText="Refreshing...."></apex:actionStatus>
         </apex:commandButton>
     <center> 
         <apex:dataTable value="{!job}" var="j" cellspacing="5">
             <apex:column >
                 <strong>Account:</strong> &nbsp; <apex:outputField value="{!j.Account__c}"/>
             </apex:column><br />
             <apex:column >
                 <strong>Job Number:</strong> &nbsp; <apex:outputField value="{!AIIncentive__c.Job__c}"/>
             </apex:column>
         </apex:datatable><br />
     </center>
         
                 
         <apex:pageblockTable value="{!Incents}" var="incent">
             <apex:column headerValue="QTY">
                 <apex:inputField value="{!incent.QTY__c}"/>
             </apex:column>
             <apex:column headerValue="Description">
                 <apex:inputField value="{!incent.Description__c}"/>
             </apex:column>
             <apex:column headerValue="Honoraria__c">
                 <apex:inputField value="{!incent.Honoraria__c}"/>
             </apex:column>
             <apex:column headerValue="Deleted">
                 <apex:inputField Value="{!incent.Deleted__c}"/>
             </apex:column>
         </apex:pageblockTable>
       
       
    </apex:pageBlock>
   </apex:form>
 
</apex:page>

 

Can someone please help me with creating an add new button for a custom object and custom edit page?

I have two Objects with a Master-Detail relationship.  I have created a custom edit page for the child object but the page only displays the line item that you click edit for and not the other child objects related to the parent.  How can I create an SOQL statement to pull in all child objects related to parent to be edited.  Code is below.

 

Parent= Job__c

Child= AIIncentive__c

 

 

VisualForce page (Second DataTable is only there to test SOQL statements)

<apex:page standardController="AIIncentive__c" extensions="Incent">
    <apex:form >
     <apex:pageBlock >
       
       <apex:pageBlockTable value="{!AIIncentive__c}" var="incent">
         <apex:column headerValue="QTY">
           <apex:inputField value="{!incent.QTY__c}"/>
         </apex:column>
         <apex:column headerValue="Description">
           <apex:inputField value="{!incent.Description__c}"/>
         </apex:column>
         <apex:column headerValue="Honoraria__c">
             <apex:inputField value="{!incent.Honoraria__c}"/>
         </apex:column>
         <apex:column headerValue="Job #">
             <apex:outputField Value="{!incent.Job__c}"/>
         </apex:column>
       </apex:PageBlockTable>
       <apex:PageBlockTable value="{!Incents}" var="I">
           <apex:column >
           <apex:OutputField value="{!I.QTY__c}"/>
           </apex:column>
       </apex:PageBlockTable>
       <apex:commandButton value="Save" action="{!save}"/>     
     </apex:pageBlock>
   </apex:form>
 
</apex:page>

 Extension

public with sharing class Incent {
public list<AIIncentive__c> Incents {get; set;}
public list<job__c> job {get; set;}
public id jobid;
public string r {get; set;}
    public Incent(ApexPages.StandardController controller) {
     jobid = apexpages.currentpage().getParameters().get('id');
        r = [Select Name, id FROM Job__c WHERE id = :jobid limit 1];
        Incents = [Select QTY__c, Description__c,  Honoraria__c, Job__c  From AIIncentive__c  where Job__c = :r];     
        }
      }
      

 

Is this possible?  I am trying to modify one of Bob Buzzard's creations to populate incentive lines. 

 

Extension:  (I am grabbing the job id of the page and searching for the Name.  I then need to inject this value into a column on the VisualForce page so that I can reference this in other places.

 

public class ManageListController
{
 public List<AIIncentiveWrapper> wrappers {get; set;}
 public static Integer toDelIdent {get; set;}
 public static Integer addCount {get; set;}
 public id jobid;
 public Job__c j;
 private Integer nextIdent=0;
  
 public ManageListController(ApexPages.StandardController controller)
 {
  jobid = apexpages.currentpage().getParameters().get('id');
  system.debug('################################## Id'+jobid);
  j = [SELECT Name FROM Job__c WHERE id=:jobid];
  wrappers=new List<AIIncentiveWrapper>();
  for (Integer idx=0; idx<1; idx++)
  {
   wrappers.add(new AIIncentiveWrapper(nextIdent++));
  }
 }
  
 public void delWrapper()
 {
  Integer toDelPos=-1;
  for (Integer idx=0; idx<wrappers.size(); idx++)
  {
   if (wrappers[idx].ident==toDelIdent)
   {
    toDelPos=idx;
   }
  }
   
  if (-1!=toDelPos)
  {
   wrappers.remove(toDelPos);
  }
 }
  
 public void addRows()
 {
  for (Integer idx=0; idx<addCount; idx++)
  {
   wrappers.add(new AIIncentiveWrapper(nextIdent++));
  }
 }
  
 public PageReference save()
 {
  List<AIIncentive__c> accs=new List<AIIncentive__c>();
  for (AIIncentiveWrapper wrap : wrappers)
  {
   accs.add(wrap.acc);
  }
   
  insert accs;
   
  return new PageReference('/' + Schema.getGlobalDescribe().get('AIIncentive__c').getDescribe().getKeyPrefix() + '/o');
 }
  
 public class AIIncentiveWrapper
 {
  public AIIncentive__c acc {get; private set;}
  public Integer ident {get; private set;}
   
  public AIIncentiveWrapper(Integer inIdent)
  {
   ident=inIdent;
   acc=new AIIncentive__c(Name='Incentives ' + ident);
  }
 }
}

 Visualforce page:  (How can I pull in my {!j} value to then spit out the Name field to each of these entries.

<apex:page standardController="Job__c" extensions="ManageListController" tabstyle="Job__c">
 <apex:form >
   <apex:pageBlock title="Incentives">
      <apex:pageBlockTable value="{!wrappers}" var="wrapper" id="wtable">
         <apex:column headerValue="Ident">
            <apex:outputText value="{!wrapper.ident}"/>
         </apex:column>
         <apex:column headerValue="QTY">
            <apex:inputField value="{!wrapper.acc.QTY__c}"/>
         </apex:column>
         <apex:column headerValue="Description">
            <apex:inputField value="{!wrapper.acc.Description__c}"/>
         </apex:column>
         <apex:column headerValue="Honoraria">
            <apex:inputField value="{!wrapper.acc.Honoraria__c}"/>
         </apex:column>
         <apex:column headerValue="Action">
            <apex:commandButton value="Delete" action="{!delWrapper}" rerender="wtable">
               <apex:param name="toDelIdent" value="{!wrapper.ident}" assignTo="{!toDelIdent}"/>
            </apex:commandButton>
         </apex:column>
      </apex:pageBlockTable>
      <apex:commandButton value="Add Row" action="{!addRows}" rerender="wtable">
         <apex:param name="addCount" value="1" assignTo="{!addCount}"/>
      </apex:commandButton>
      <apex:commandButton value="Add 5 Rows" action="{!addRows}" rerender="wtable">
         <apex:param name="addCount" value="5" assignTo="{!addCount}"/>
      </apex:commandButton>
      <apex:commandButton value="Save" action="{!save}"/>
   </apex:pageBlock>
 </apex:form>
</apex:page>

 

I am using the following code to generate a popup off of the accounts page.

 

<apex:page standardController="Account">
<apex:includeScript value="{!URLFOR($Resource.jquery)}"/>
<apex:includeScript value="{!URLFOR($Resource.jalert, 'jquery.alerts.js')}"/>
<apex:stylesheet value="{!URLFOR($Resource.jalert, 'jquery.alerts.css')}"/>





<script type="text/javascript">

    jAlert('<b>Facility:</b> {!Account.Facility_SOPs__c}', 'SOPs');

</script>


</apex:page>

 How can I make this popup to the parent page.  It is currently poping up within it's respective field

I am using the following code to create a popup on the Account page when a custom field is NOT NULL

 

<apex:page standardController="Account" rendered="{!Account.Facility_SOPs__c==null}">
 <script type="text/javascript">
     {
         window.alert("Please review Facility SOPs: {!Account.Facility_SOPs__c}");
     }
 </script>
</apex:page>

 If I remove the second = making the redered=NULL the popup will be displayed on accounts where the field is null.  I need the opposite to happen, but it doesn't appear to work when I designate NOT NULL using ==

I have created a form that our company uses for an incentive invoice. This form is generated off of a custom object that would retain the information. The invoice has a fluctuating number of line items and I would like users to be able to add/subtract these items as needed without having to create a bunch of unnecessary fields.  Is there any way to do this?

I am loading an image using <img src> in a visualforce page that exports to a word doc.  The image loads fine, but when I go to save the document locally and send it to another person, it still has to download that image from the web.  Is there any way to make the local word doc save the images into the document?  I am asking this because it seems like Office 2007 will not download the images and I can't rely on a solution that only works for Office 2010.  Just to be clear I tried loading the image as a static resource, but the word doc would not recognize it.  Which is why i tried an img src tag.

How can I modify the below code to pull from the current user instead of the name from the PM__c field?

 

u = [Select Extension, Email From User  where Name = :j.PM__c limit 1];

Where can I find this security control?

<apex:outputtext style="font-size:15px" value="for {!Quote.Opportunity.End_Client__c}"/>

 

This code pulls the End_Client ID instead of the name, how can I change that?

How can I get the related AccountId from the Opportunity with Quote as my controller?

How can I match a multi picklist to its related values.  For instance

 

Object= Locations

 

field= Locations__c

 

field value= Atlanta, GA; NY,NY(NYC)

 

I need to return fields from the Atlanta,GA and NY,NY(NYC) Locations

dFirst time poster.

 

So I created my first Apex Trigger, which is relatively simple and creates a case record whenever an opportunity is set to 'closed(won)'. It carries in some custom information over to the fields (code is below). The trigger works fine in my sandbox, but when moving it to production I ran into the test coverage needed by force.com. I should say that I used to program many years ago and this is my reintroduction to programing, so I'm a bit rusty. I have downloaded eclipse and the IDE tools (although I'm not certain I need them) and have been researching test methods. I created this so far, but was looking to the community for some assistance. I have always learned best off example code (vs reading large data sheets).

 

 

My Trigger:

 

}

trigger NewDeploymentCaseFromOpp on Opportunity (after update) {

for (Opportunity opp : Trigger.new

 { 

    if ( (opp.stagename == 'Closed Won' ) && (opp.booking_type__c != 'Renewal') && (trigger.oldMap.get(opp.id).stagename != 'Closed Won' ) )

         {

         list<Account> act=[select id,name from Account where Id=:opp.AccountId];

         list<contact> ct=[select id from Contact where AccountId=:act[0].id];

                       Case c = new Case

                           AccountID = opp.AccountId, 

                           Status = 'New'

                           Origin = 'Email',

                           ContactID = ct[0].id,

                           Products__c = opp.Products__c,

                           Subject = 'Deployment Case for '+act[0].name, 

                           OwnerId= '00GS0000000uYbm'

                           RecordTypeId = '012S00000004UAS'

                           Account_Executive__c = opp.OwnerId

                           );   

                           

                       insert c; 

                       break;

                    }

           

    

 } 

 

 

My test method in Eclipse, which is a Class 

 

}

privateclass Test {

statictestMethodvoid myTest(){

Account account = new Account (name='some name account');

insert account; 

Opportunity opportunity = new Opportunity (name='some name', Account=account);

insert opportunity;

 

}

 

A few things:

A) when I try to run my test method i get the error "unexpected token: testMethod. From what I can tell, I'm using this method correctly.

B) when copying out of eclipse, i notice that preceeding all my code I have a } bracket, which does not appear in the editor. Is this normal?  

 

Hello,

 

I have a dynamic binding which generates the sum of a column using a SOQL query.  I want this some to be formatted and displayed for currency.  I can't use the param value of apex:outputext because the value is not populated until run time, so I am getting save errors.  I figure I need to format this in the class and then spit out my formatted value and call that as a dynamic binding, I just can't get it to work.  Can anyone help me figure out how to take this value and format it in this manor? 0, number, ###,###,##0.00

 

public SObject getsumIncentive(){
        SObject sumIncentive;
        sumIncentive = [SELECT SUM(Total__c) sum FROM AIIncentive__c WHERE Job__c =:jobid];
        return sumIncentive;
        }

 

Hello,

 

I need to do some calculations on cells in a datatable to generate sums, for instance, I have a QTY field and a Honoraria field.  I need to mutiply the value of the Honoraria field by the QTY field to give me my Total.  How can I do this in either Javascript or Apex?  Code examples below,

 

 

DataTable

<apex:dataTable id="incentives" cellpadding="4px" width="100%" frame="none" border="1" Value="{!Incents}" Var="I">
                <apex:column width="20%">
                    <apex:outputField value="{!I.QTY__c}"/>
                </apex:column>
                <apex:column width="60%">
                    <apex:outputField value="{!I.Description__c}"/>
                </apex:column>
                <apex:column width="20%">
                    <apex:outputField value="{!I.Honoraria__c}"/>
                </apex:column>
            </apex:dataTable>

 

Extension

 

public with sharing class Incent {
public list<AIIncentive__c> Incents {get; set;}
public list<job__c> job {get; set;}
public id jobid;
public string NewIncentive {get; set;}
public PageReference refresh = ApexPages.currentPage(); 

    public Incent(ApexPages.StandardController controller) {
    	
     	jobid = apexpages.currentpage().getParameters().get('id');
        system.debug('################################## Id'+jobid);

        Incents = [Select QTY__c, Description__c,  Honoraria__c, Job__c, Deleted__c  From AIIncentive__c  where Job__c = :jobid]; 
        
        job = [SELECT Account__c FROM Job__c WHERE id= :jobid];    
        
        }


    public PageReference NewIncentive(){
    	
    	AIIncentive__c obj = new AIIncentive__c();

          	obj.QTY__c = 0;
     		obj.Description__c = '';
     		obj.Honoraria__c = 0;
     		obj.Job__c = jobid;

	 	update Incents;
	 		 
     	insert obj;
     
        	refresh.setRedirect(true);
     
   	 	return refresh;
     
    }
    
    public PageReference save() {
        	        	
    	update Incents;
        
	        refresh.setRedirect(true);        

        return refresh;

    }
    
 
//    public PageReference SaveReturn() {
    	
    	
//    	update Incents;
    		
    	
//    	return 
    		
//    }
       
    
}

 

Hello,

 

I am trying to render datatables based on the values of two date fields matching, or not.  Below is the code I am trying to use, but it doesn't work.  Basically if the Start Date equals the End Date I want to populate one datatable and if not I want to populate the other.

 

<apex:dataTable rendered="{!IF(Job__c.Job_Start_Date__c == Job__c.Job_End_Date__c,true,false)}" style="font-family: Calibri, sans-serif; font-size: 12px" value="{!Job__c}" var="j" rowClasses="odd,even">
    
                    	<apex:column >
                        	<apex:outputtext value="{0,date,MM/dd/yyyy}">
                            	<apex:param value="{!j.Job_Start_Date__c}" />
                        	</apex:outputtext>
 -                 
                        	<apex:outputtext value="{0,date,MM/dd/yyyy}">
                            	<apex:param value="{!j.Job_End_Date__c}" />
                        	</apex:outputtext>
                    	</apex:column>
            
                	</apex:dataTable>            	
            	
                	<apex:dataTable rendered="{!IF(Job__c.Job_Start_Date__c = Job__c.Job_End_Date__c,true,false)}" style="font-family: Calibri, sans-serif; font-size: 12px" value="{!Job__c}" var="j" rowClasses="odd,even">
    
                    	<apex:column >
                        	<apex:outputtext value="{0,date,MM/dd/yyyy}">
                            	<apex:param value="{!j.Job_Start_Date__c}" />
                        	</apex:outputtext>                 
                        </apex:column>
                        	
                	</apex:dataTable>    

 

Hello,

 

I am trying to create a save and return button for my custom edit page and I am struggling to get a page reference that will return the user to the previous page.  What method do I use to return the Previous Page?

Hello,

 

I have a custom edit page for a custom object which is doing almost everything that I need it to do.  The final piece is to save all the records on the current page before returning a new value.  Currently when you click the New button the new row will be added but will not retain changes made to the other rows.  Both my Visualforce and Controller are below:

 

Controller

 

public with sharing class Incent {
public list<AIIncentive__c> Incents {get; set;}
public list<job__c> job {get; set;}
public id jobid;
public string Button {get; set;}
    public Incent(ApexPages.StandardController controller) {
     id incentId= apexpages.currentpage().getParameters().get('id');
        jobid=[select id, Job__c from AIIncentive__c where id=:incentId].Job__c;

        Incents = [Select QTY__c, Description__c,  Honoraria__c, Job__c, Deleted__c  From AIIncentive__c  where Job__c = :jobid]; 
        job = [SELECT Account__c FROM Job__c WHERE id= :jobid];    
        }
      
      
    public PageReference Button(){

     AIIncentive__c obj = new AIIncentive__c();
     
     obj.QTY__c = 0;
     obj.Description__c = '';
     obj.Honoraria__c = 0;
     obj.Job__c = jobid;


    insert obj;
    
    PageReference acctPage = ApexPages.currentpage();
    

      acctPage.setRedirect(true);



      return acctPage;
     
     }
    }

 

Visualforce

 

<apex:page standardController="AIIncentive__c" extensions="Incent">
    <apex:form >
     <apex:pageBlock title="Edit Incentives">
     
         <apex:commandButton value="Save & Return" action="{!save}"/> 
         <apex:commandButton value="New" action="{!Button}">
             <apex:actionSupport event="onclick" rerender="incenttable" status="refreshstatus"/>
             <apex:actionStatus id="refreshstatus" startstyle="color:green;" startText="Refreshing...."></apex:actionStatus>
         </apex:commandButton>
     <center> 
         <apex:dataTable value="{!job}" var="j" cellspacing="5">
             <apex:column >
                 <strong>Account:</strong> &nbsp; <apex:outputField value="{!j.Account__c}"/>
             </apex:column><br />
             <apex:column >
                 <strong>Job Number:</strong> &nbsp; <apex:outputField value="{!AIIncentive__c.Job__c}"/>
             </apex:column>
         </apex:datatable><br />
     </center>
         
                 
         <apex:pageblockTable value="{!Incents}" var="incent">
             <apex:column headerValue="QTY">
                 <apex:inputField value="{!incent.QTY__c}"/>
             </apex:column>
             <apex:column headerValue="Description">
                 <apex:inputField value="{!incent.Description__c}"/>
             </apex:column>
             <apex:column headerValue="Honoraria__c">
                 <apex:inputField value="{!incent.Honoraria__c}"/>
             </apex:column>
             <apex:column headerValue="Deleted">
                 <apex:inputField Value="{!incent.Deleted__c}"/>
             </apex:column>
         </apex:pageblockTable>
       
       
    </apex:pageBlock>
   </apex:form>
 
</apex:page>

 

Can someone please help me with creating an add new button for a custom object and custom edit page?

I have two Objects with a Master-Detail relationship.  I have created a custom edit page for the child object but the page only displays the line item that you click edit for and not the other child objects related to the parent.  How can I create an SOQL statement to pull in all child objects related to parent to be edited.  Code is below.

 

Parent= Job__c

Child= AIIncentive__c

 

 

VisualForce page (Second DataTable is only there to test SOQL statements)

<apex:page standardController="AIIncentive__c" extensions="Incent">
    <apex:form >
     <apex:pageBlock >
       
       <apex:pageBlockTable value="{!AIIncentive__c}" var="incent">
         <apex:column headerValue="QTY">
           <apex:inputField value="{!incent.QTY__c}"/>
         </apex:column>
         <apex:column headerValue="Description">
           <apex:inputField value="{!incent.Description__c}"/>
         </apex:column>
         <apex:column headerValue="Honoraria__c">
             <apex:inputField value="{!incent.Honoraria__c}"/>
         </apex:column>
         <apex:column headerValue="Job #">
             <apex:outputField Value="{!incent.Job__c}"/>
         </apex:column>
       </apex:PageBlockTable>
       <apex:PageBlockTable value="{!Incents}" var="I">
           <apex:column >
           <apex:OutputField value="{!I.QTY__c}"/>
           </apex:column>
       </apex:PageBlockTable>
       <apex:commandButton value="Save" action="{!save}"/>     
     </apex:pageBlock>
   </apex:form>
 
</apex:page>

 Extension

public with sharing class Incent {
public list<AIIncentive__c> Incents {get; set;}
public list<job__c> job {get; set;}
public id jobid;
public string r {get; set;}
    public Incent(ApexPages.StandardController controller) {
     jobid = apexpages.currentpage().getParameters().get('id');
        r = [Select Name, id FROM Job__c WHERE id = :jobid limit 1];
        Incents = [Select QTY__c, Description__c,  Honoraria__c, Job__c  From AIIncentive__c  where Job__c = :r];     
        }
      }
      

 

does anyone know of a way to make this work?  Currently the PDF populates with the HTML.