• Shiv Shankar
  • NEWBIE
  • 480 Points
  • Member since 2011

  • Chatter
    Feed
  • 16
    Best Answers
  • 1
    Likes Received
  • 0
    Likes Given
  • 36
    Questions
  • 150
    Replies

I have a requirement where a datatable of clients must be hidden by default (i.e. on page load). The table appears and populates only when a certain command link is clicked. How do I go about achieving this?

 

This is the datatable I have so far:

 

<apex:dataTable id="clientDataTable" value="{!clientList}"
            				var="clientRecord" width="100%">
                <apex:column headerValue="Client Name" width="30%">
                    <apex:outputText value="{!clientRecord.Client_Name__c}"/>
                </apex:column>
                <apex:column headerValue="Description of Fund Raising Activities" width="30%">
                    <apex:outputField value="{!clientRecord.Description__c}"/>
                </apex:column>
                <apex:column headerValue="Start Date" width="20%">
                    <apex:outputText value="{!clientRecord.Start_Date__c}"/>
                </apex:column>
                <apex:column headerValue="End Date" width="20%" >
                    <apex:outputText value="{!clientRecord.End_Date__c}"/>
                </apex:column>
                <apex:column headerValue="Pro-Bono" width="10%">
                    <apex:outputText value="{!IF(clientRecord.Pro_Bono__c, 'Yes', 'No')}"/>
                </apex:column>
            </apex:dataTable>

 


Thanks,

Sanjeev

I'm trying to update fields of a custom object along with fields of a related object. The fields of the primary object are updated without a problem, but none of the related object fields are updated. Notice that the saveRecord() method calls update on both objects. How can I accomplish this?

 

Visualforce:

 

<apex:page showHeader="false" standardController="PrimaryObject__c" extensions="controlEntity" sidebar="false" standardstylesheets="false">

<apex:form> <div> <apex:inputField value="{!PrimaryObject__c.Name}" />
<apex:commandButton action="{!saveRecord}" value="Save"/>

<apex:inputField value="{!PrimaryObject__c.LookupField__r.Name}" /> <apex:inputField value="{!PrimaryObject__c.LookupField__r.Address__c}" /> <apex:inputField value="{!PrimaryObject__c.LookupField__r.City__c}" /> <apex:inputField value="{!PrimaryObject__c.LookupField__r.State_Province__c}" /> <apex:inputField value="{!PrimaryObject__c.LookupField__r.Zip_Postal_Code__c} " /> <apex:inputField value="{!PrimaryObject__c.Email_1__c}" /> <apex:inputField value="{!PrimaryObject__c.Email_2__c}" /> <apex:inputField value="{!PrimaryObject__c.Phone_1__c}" /> <apex:inputField value="{!PrimaryObject__c.Phone_2__c}" /> <apex:inputField value="{!PrimaryObject__c.Inactive__c}" /> </div> </apex:form> </apex:page>

 

 

Extension class:

 

public with sharing class controlEntity {
    public PrimaryObject__c entity;
    public RelatedObject__c contact;
    
    public controlEntity(ApexPages.StandardController controller) {
        this.entity = (PrimaryObject__c)controller.getRecord();
        this.contact = [SELECT Name, Address__c, City__c, State_Province__c, Zip_Postal_Code__c FROM RelatedObject__c WHERE Customer_Vendor__c = :ApexPages.currentPage().getParameters().get('id')];
    }
    
    public PageReference saveRecord() {
        update entity;
        update contact;
        return null;
    }
 }

 Thank you.

Hi

 

Already I have one visual force page I need to create another visual page in that VF page is it possible? if yes means give me some examples.

 

 

Regards,

Rajesh

Have a process that requires creating both a Contact and a Lead, once the Contact page is saved the Lead page opens and don't want the user to have to type in the same info again.  Below is what I have and I'm passing the entered values in the URL '...?FirstName={!Contact.FirstName}... etc'.

When this page renders is shows the values but outside the fields that I need them saved to.  Suggestions?

 

apex:page standardController="Lead" sidebar="false" showHeader="false">
    <apex:form >
        <apex:pageMessages />
        <apex:pageBlock title="Sales Lead">
            <apex:pageBlockButtons >
                <apex:commandButton value="Save" action="{! save}"/>
                <input type="button" value="Cancel" class="btn" onclick="window.parent.closepop();"/>
            </apex:pageBlockButtons>
      <apex:pageBlockSection title="Lead" collapsible="false" columns="1">
          <apex:inputField value="{!Lead.company}" />
          <apex:inputField value="{!Lead.firstname}">{!$CurrentPage.parameters.FirstName}</apex:inputField>
          <apex:inputField value="{!Lead.lastname}">{!$CurrentPage.parameters.LastName} </apex:inputField>
          <apex:inputField value="{!Lead.Product_Group__c}" required="True"/>
          <apex:inputField value="{!Lead.Phone}" />
          <apex:inputField value="{!Lead.Email}" />
      </apex:pageBlockSection>
    </apex:pageBlock>
  </apex:form>
</apex:page>

 

I'm trying to access a contact object field through a related object's lookup field. Billing_contact__c below (2nd <td>) is an entity object lookup field that has a related contact record. When I reference the Address__c field in the contact object, I get the following error:

 

Error: Unknown property 'String.Address__c'

 

Any idea why? And how can I accomplish my goal of displaying this contact object field?

 

                <apex:repeat value="{!entities}" var="r">
                    <tr>
                      <td>{!r.Name}</td>
                      <td>{!r.Billing_Contact__c.Address__c}</td>
                      <td>{!r.Email_1__c}</td>
                      <td>{!r.Phone_1__c}</td>
                      <td><apex:outputfield value="{!r.Inactive__c}"></apex:outputfield></td>
                      <td>{!r.CreatedBy.Name}</td>
                  </tr>
                 </apex:repeat>

 

I'm designing a sign-in page for events.  When attendees sign in, I'd like the page to acknowledge them with "Bob, thanks for attending."  And then after 2 seconds, I'd like the page to return to the blank signin form for the next attendee.

 

I haven't been able to find anything that allows me to delay execution like this in the documentation so far.  Any ideas?

HI ,

 

Can we insert  the records of any object when page is loaded? Please reply me.

 

 

Regards,

Rajesh.

i have a custom field in account object called count.it should display the number contacts related to that account....like if we added one contact to the account count should be increased or if contact is deleted contact should be decreased..
how to write a trigger to this...

 

 

Thanks in advance

 

Hey there,

 

I want to create a list of all Objects in my Org and then filter them by my definied List, how can i do this?

 

So I have created a list of all Objects like this:

 

public List<SelectOption> getName(){
List<Schema.SObjectType> gd = Schema.getGlobalDescribe().Values();
List<SelectOption> options = new List<SelectOption>();
for(Schema.SObjectType f : gd){
options.add(new SelectOption(f.getDescribe().getLabel(),f.getDescribe().getLabel()));
}
return options;
}

 

This actually works fine.

But I'd like to create a filter, so i made this List of Selectoptions:

 

public List <SelectOption> testObjects = new List <SelectOption>();

public TestOverrideSettingController(ApexPages.StandardController stdController){
testObjects.add(new SelectOption('Event','Event'));
testObjects.add(new SelectOption('Account','Account'));
testObjects.add(new SelectOption('Contact','Contact'));
}

 

But now I don't know how to go on and compare the Elements in the 2 Lists to each other.

 

Thanks a lot for every help.

  • March 11, 2013
  • Like
  • 0

Hello,

I'm using a custom controller on a visualforce page to access a list of records which are unrelated. I get the de-reference null error on the visualforce page when I land on it. I am comparing a multiselect picklist field called protocols__c on the account object with a  string field on an object called AlertManagement__c.  If they equal each other then i want to populate them to the listGrab which my visualforce getter should show on the page. This is being accessed through the customer portal.

 

I realise that the null error is being thrown because of the  listGrab.add(al);  If I take it out the error isn't thrown.

However i know that the listFlux I am iterating over is not empty.  Is there something I am not declaring or am I going about this in the wrong way? Can someone help or give me some direction?

 

Thanks!

 

Here is the visualforce page part which is accessing the controller
        <apex:repeat value="{!listgrab}" var="f">
        <li>            
                    <span style="font-size: 13px;"><b>{!f.Description__c}</b>
                        <br/><apex:outputtext value="{!f.Alert_Message__c}" escape="false"/></span>
         
        </li>
        </apex:repeat>

 

 

Here the controller

 

public class portalHomePageController {
    public List <Contact> oContact {get;set;}
    public List <AlertManagement__c> listGrab {get;set;}
    
    
    public portalHomePageController(){
        
        User u=[select id, ContactId from User where id=:userinfo.getuserid()];
        oContact=[select id, Name, Account.Name,Account.Bank__c,Account.Protocol__c from Contact where id=:u.ContactId];
        List <AlertManagement__c> listFlux=[select id, Description__c,Description_FR__c, Alert_Message__c,Alert_Message_FR__c,        
        Bank__c,Platform__c,Protocol__c from AlertManagement__c where Active__c=true];
                        
           // iterate over the list of contacts which should only be one

           for(Contact oc: oContact){

 

            // Here i am splitting out the multiselect values into a string
            string[] protocols = oc.Account.Protocol__c.split(';',0);
         
            // Here I am iterating over the list of alerts               

            for(AlertManagement__c al: listFlux){
                                
                    if(protocols != null && protocols.size() >0){
                        //Now iterate over the array of multiselect values from above

                        for(String p: protocols){                                                 
                             // the value of the string from the multiselect == the value of the text string on the aler record

                             if(p == al.Protocol__c){
                                //add the alert record to the listGrab to show on the visualforce page.
                                listGrab.add(al);
                                
                        
                            }
                        }
                    }    
                }
        }
    }
}

I've done quite a bit of research on the forums on how to include a "simple" Google Map example, and have tried many of them. With all , I seem to end up in the same place as a lot of others end up based on the forum comments - the map never actually comes up. I have a valid API key that I substitute, and still nothing comes up - just a blank VF page. Does anyone have a real working example that I could review and modify?

 

 I just want to display a set of locations on the map. In my case, location is a custom object with country, state,city and zip (not a standard account record). If I can just get something basic working (i.e. actually see a map), I can then modify it to also set the marker colors based on some properties of the location - it's for a dashboard.

 

Any help would be greatly appreciated (something in API V3 would be best, but at least an example that works). I thought this was going to be simple...

I was trying the jquery pop up from developer force

http://developer.force.com/cookbook/recipe/using-jquery-in-a-visualforce-page

and i  dont see the dialog box, I thought I would implement this in my org if it works. I have added the jquery library and there is no pop up blocker.

 

Has anyoen tried this and if it worked please let me know, as i am planning to implement

 

 

<apex:page showheader="false" standardController="Account" recordsetVar="accounts" showHeader="true" >
<head>
<apex:includeScript value="{!URLFOR($Resource.jQuery, '/js/jquery-1.4.2.min.js')}"  />
<apex:includeScript value="{!URLFOR($Resource.jQuery, '/js/jquery-ui-1.8.6.custom.min.js')}"  />
<apex:stylesheet value="{!URLFOR($Resource.jQuery, '/css/ui-lightness/jquery-ui-1.8.6.custom.css')}"  />
<script>
   $j = jQuery.noConflict();
   $j(document).ready(function() {
    $j("#phone").dialog({ autoOpen: false, modal: true, position: 'center'  });
   });
   
   function showDialog(name, phone){
      $j("#phoneNumber").html(phone);
      $j("#phone").dialog("open");
      $j('#phone').dialog("option" , "title" , name);
      $j('#phone').dialog('option', 'position', 'center');
      return false;
   }
</script>
<style>
    .accountLink { color: blue; cursor: pointer; cursor: hand; }
</style>
</head>    
 
<body>

  <apex:dataList value="{!accounts}" var="account" id="theList">
        <a href="" class="accountLink" onclick="return showDialog('{!account.name}','{!account.Phone}')"><apex:outputText value="{!account.name}"/></a>
  </apex:dataList>
 
  <div id="phone" >
      <div style="float:left">Phone:</div>
      <div id="phoneNumber"></div>
  </div>
 
</body>
</apex:page>

 

All,

I am trying to query for activity history and not allow change of status if there is no record for it.

Since activity history is special type, i could not use activityhistory in map since it cannot be queried so had to use

case. however, my code is not working it allows to change status despite there being no activityhistory.

 

what needs to be changed below?

 

thanks

 

 

 

 

trigger Checkcaseactivity on Case (before update) {
     public Set<Id> setCaseId = new Set<Id>();
     public Map<Id,case> mapActivityHisstory=new Map<Id,case>();
    
     for(Case c: Trigger.New){
         if(c.Status !=null && c.Status=='New' && c.Status != trigger.OldMap.get(c.Id).Status){
              setCaseId.add(c.Id);
         }
     }
     if(setCaseId.ISEMPTY()) return;
                     
      For(case ct:  [SELECT (SELECT ActivityDate, Description,id,activitytype from ActivityHistories) FROM case
 WHERE Id  IN : setCaseId]){
            mapActivityHisstory.put(ct.Id,ct);
     }

     for(Case c: Trigger.New){
              if(mapActivityHisstory.get(c.Id) ==null){
                   c.addError('No Activity');
              }
     }
}

Hi,

 

I've created a VF page where i'm suing google charts API.

 

Source of my information :http://developer.force.com/cookbook/recipe/easy-visualforce-charts-with-javascript-remoting--google-charts-api

 

Is it possible to have 2 charts on the same page?

 

Thanks in Advance,

Rohit

  • February 28, 2013
  • Like
  • 0

I have a VF page that is being populated via a standard controller.

It works fine when all my child lines in the controller are specified.

If my controller does not return anything ( in the example - No contact role assigned to the opportunity object ) I have the 'PDF generation failed. Check the page markup is valid.' error.

 

From browsing the forum, I can see that I need to use the Rendering method, either in the <apex:repeat />  or <apex:outputField />, but i have not been able to find in which order nor which synthax.

 

Would you be able to get me an insight?

 

Below is the summarised version of my VF Page:

 

<apex:page standardController="Opportunity" showHeader="false" renderas="pdf" extensions="BSL_Layout_LinkOppLines" >
<apex:stylesheet value="{!$Resource.CSS_GeneratePDF}"/>
<table border="0" cellspacing="0" cellpadding="0" width="100%" id="table1">
<tr>
    <td  align="left"><font face="Arial" >
    <h2><b>{!Opportunity.Name}</b></h2></font>
    </td>
</tr>
</table>

<br/>
<hr/>
<p><b><font color="#000080" face="Arial">Contact Roles / Value Chain Member</font></b></p>
<table border="0" width="100%" id="table4">
<tr>
       <td bgcolor="#C0C0C0"><font face="Arial">Contact</font></td>
       <td bgcolor="#C0C0C0"><font face="Arial">Account</font></td>
       <td bgcolor="#C0C0C0"><font face="Arial">Phone</font></td>
       <td bgcolor="#C0C0C0"><font face="Arial">Role</font></td> 
</tr>
<tr>
       <apex:repeat value="{!OpplineContactRole}" var="lineContact">
          <tr>
        <td><apex:outputField value="{!lineContact.ContactId}"/></td>
        <td><apex:outputField value="{!lineContact.Contact.AccountId}"/></td>
        <td><apex:outputField value="{!lineContact.Contact.Phone}"/></td>
        <td><apex:outputField value="{!lineContact.Role}"/></td>
          </tr>
       </apex:repeat>  
</tr>
</table>
</apex:page>

And here is my Extension Class:

 

public class BSL_Layout_LinkOppLines{

  public List<OpportunityContactRole> OpplineContactRole{get;set;}

 
  public BSL_Layout_LinkOppLines(ApexPages.StandardController controller){
                              
   OpplineContactRole=[select Id, OpportunityId, ContactId, Role, Contact.AccountId, Contact.Phone
                              from OpportunityContactRole
                              where OpportunityId =:(ApexPages.CurrentPage().getParameters().get('id'))];         
   }
       
}

 

 Thanks

 

My Requirement is to create

 

VF Page: PDF that should have Opportunity Name, Opportunity.Account Billing Address in the header, Body should have Table with Opportunity Products, Footer should have Organization details.

 

Button in the Opportunity view page that will open the above pdf (pdf will have the values of the above fields of each record).

 

I'm able to acheieve this, but still has a problem.

 

My Problem is few records are not displaying the details of opportunity name, account billing address (these records still has the opportunity name, Account billing address etc). Can anyone about this..like account has the content, opportunity has the content too, but not displaying the content.

  • October 01, 2012
  • Like
  • 0
what is the maximum limit of extensions in VF page. <apex:page controller="abc" extensions="ext1, ext2, ext3,........ how many we can use ? "
what is the maximum limit of extensions in VF page. <apex:page controller="abc" extensions="ext1, ext2, ext3,........ how many we can use ? "
Hi all,
I have one visual force page and it's respective controller.
Controller code :
public with sharing class testAccount
{
   public SObject act{get;set;}
   public testAccount()
   {
      act = new Account();
   }

   public void save()
   {
       insert act;
    }
}

VF Page :<apex:page controller="testAccount">
<apex:form >
   <apex:commandButton action="{! save}" value="save"/>
  <apex:pageblock >
   <apex:pageblocksection >
    <apex:inputField value="{! act.Name}"/>
    <apex:inputField value="{! act.Type}"/>
    <apex:inputField value="{! act.Industry}"/>
   </apex:pageblocksection>
  </apex:pageblock>
</apex:form>
</apex:page>

while rendering page i am getting following error :

Insufficient Privileges
You do not have the level of access necessary to perform the operation you requested. Please contact the owner of the record or your administrator if access is necessary.

But in controller if change the first line (public SObject act{get;set;}) to like this way :
public Account act{get;set;} , i don't get any error.
In my requirement i don't know which object fields need to be display on VF Page. So i want to use sObject. but it's not working the way i want. please help it's urgent. Thanks
Hi all,
I have one visual force page and it's respective controller.
Controller code :
public with sharing class testAccount
{
   public SObject act{get;set;}
   public testAccount()
   {
      act = new Account();
   }

   public void save()
   {
       insert act;
    }
}

VF Page :<apex:page controller="testAccount">
<apex:form >
   <apex:commandButton action="{! save}" value="save"/>
  <apex:pageblock >
   <apex:pageblocksection >
    <apex:inputField value="{! act.Name}"/>
    <apex:inputField value="{! act.Type}"/>
    <apex:inputField value="{! act.Industry}"/>
   </apex:pageblocksection>
  </apex:pageblock>
</apex:form>
</apex:page>

while rendering page i am getting following error :

Insufficient Privileges
You do not have the level of access necessary to perform the operation you requested. Please contact the owner of the record or your administrator if access is necessary.

But in controller if change the first line (public SObject act{get;set;}) to like this way :
public Account act{get;set;} , i don't get any error.
In my requirement i don't know which object fields need to be display on VF Page. So i want to use sObject. but it's not working the way i want. please help it's urgent. Thanks

Hi All,

 

Please give me a fine knowledge on  visuforce components. How i come to that , this is the best time to use apex:component. Let me know when you generally use apex:componet.

 

Thaks

Hi All,

 

I have one scinario. in that scinario I am making a multiple record editing page. Where user can add, Edit , delete multiple records at a time.

I have some of the fields required in that object. Please have a look of following image for better understading : 

 

https://drive.google.com/file/d/0B-kKCGMuue-fdFpqT19YMDhWbEU/edit?usp=sharing

 

I want to know what is the best way to send selected recordIds from the VF Page to the Controller.

 

Hi All,

 

I have one scinario. in that scinario I am making a multiple record editing page. Where user can add, Edit , delete multiple records at a time.

I have some of the fields required in that object. Please have a look of following image for better understading : 

 

https://drive.google.com/file/d/0B-kKCGMuue-fdFpqT19YMDhWbEU/edit?usp=sharing

 

I want to know what is the best way to send selected recordIds from the VF Page to the Controller.

 

Thanks

Hi All,

 

I have one scinario. in that scinario I am making a multiple record editing page. Where user can add, Edit , delete multiple records at a time.

I have some of the fields required in that object. Please have a look of following image for better understading : 

 

https://drive.google.com/file/d/0B-kKCGMuue-fdFpqT19YMDhWbEU/edit?usp=sharing

 

Problems : 

1. suppose user hit on '+' button he will get a new row. But if he want to do undo, by selecting 2nd row and click on '-' sign than also it is asking to enter required field.

2. If i use Immediate or apex:actionregion than selected list is not passing to controller and it showing error please select a row (Which i am thorwing)

 

Can anyone provide best solution for this type of scinario

 

---- Lot of thanks for the help ---

 

 

Hi all, i have seen standard VF page in chrome by inspect element. I have observed that in edit mode input box has id attribute(18digit id)... so i though they have implemented like this way...

----------only example--------------------

<apex:page standardController='Account' extension="xyz">
  <apex:inputField id="{act.id}" value="{act.NoOfEmployee__c}">
</apex:page>



public class xyz(){
  public xyz(ApexPages.......) {
    act = [select id, NoOfEmployee__c FROM Account WHERE Id := 
           'xyzabc'];
  }
}

 but when i assing id attribute id attribute i get's error, this attribute can not be dynamically assigned..... so how salesforce people writing code to assign dynamic IDs ? please help me...

Hi Friends,

What is the use of return statement here

 

<apex:commandButton action="controllerMethod()" onclick="return javaScriptMethod()" rerender="abc" />

 

Hi Friends,

 

What is the use of return statement here

 

<apex:commandButton action="controllerMethod()" onclick="return javaScriptMethod()" />

 

Hi friends,

 

I have a VF tag like this :

 

<apex:inputtext onkeypress="isEnter(event)" value="{! currentPageNo}" />

 

 

JS like this :

      //To check either Enter key pressed in Page No input text or not.
      function isEnter(event){
          if (event.keyCode == 13){
              jumpOnPage(2);
          }
      }

 Action function is like this :

     <apex:actionFunction name="jumpOnPage" action="{! jumpOnPage}" reRender="mpb">
         <apex:param name="pageNo" value="" assignTo="{! pageNo}"/>
     </apex:actionFunction>

 Problem is : when i am presseing enter the whole page is refreshing not the particular component of page. How to resolve this.

Hi Friends,

 

I have multiple currency activate in one organisation. A user fills an amount in different currency. i am using this field, in some calculation in controller. My requirement is that before using this amount field in calculation, it should be converted in to default organisation currecy value. How can i achieve this ?

Hi Friends,

 

I have written a VF Page

 

<apex:page standardController="Request__c" standardStylesheets="false" showHeader="false" sidebar="false">
<html>
<head>
    <apex:stylesheet value="{! URLFOR($Resource.Src, 'Src/css/all.css')}"/>
    <apex:stylesheet value="{! URLFOR($Resource.Src, 'Src/css/jcf.css')}"/>
    <style>
        .requests-table{
            border-collapse:collapse;
            width:590px;
            border:1px solid #e5e5e5;
            margin:0 0 14px;
        }
        .requests-table th,
        .requests-table td{
            background:#f5f5f5;
            font:bold 12px/14px Arial, Helvetica, sans-serif;
            color:#5b5b5b;
            width:105px;
            padding:0 5px 0 10px;
            height:25px;
            border-left:1px solid #fff;
            text-align:center;
        }
        .requests-table th:first-child{border:none;}
        .requests-table th.col-last,
        .requests-table td.col-last{width:auto;}
        .requests-table td{
            background:none;
            height:26px;
            border:1px solid #e5e5e5;
            font-weight:normal;
            color:#8e8e8e;
            padding:3px 5px 0 10px;
        }
        .requests-table td.col-last{
            text-align:center;
            font:bold 24px/26px Arial, Helvetica, sans-serif;
            color:#8e8e8e;
            padding:3px 27px 0 10px;
            height:26px;
        }
        
        td, th {
            text-align:center;
            border:1px solid #e5e5e5;
        }
    </style>
</head>     
<body>
<div style="background-color:#ffffff">   shiv - {! $CurrentPage.parameters.id}
<apex:image style="text-align:left" url="https://c.cs10.content.force.com/servlet/servlet.ImageServer?id=015J00000005plL&oid=00DJ0000001HSJK&lastMod=1364884170000"/><br/>
<p>Dear {! $CurrentPage.parameters.firstName} &nbsp; {! $CurrentPage.parameters.lastName}</p>

<p>You placed a request through Givaudan Direct/Connect on &nbsp; <apex:outputText value="{0,date,MM'/'dd'/'yyyy}"><apex:param value="{! Request__c.CreatedDate}"/> </apex:outputText>.
Here is the details of your request:
</p>

<table class="requests-table">
    <thead>
        <th>
            Item Nb
        </th>
        <th>
            Description
        </th>
        <th>
            Sales Nb
        </th>
        <th>
            Sample
        </th>   
        <th>
            Quote
        </th>
        <th>
            Regulatory Doc
        </th>
    </thead>
    <tbody>
        <apex:variable var="itemNum" value="{! 01}"/>
        <apex:repeat value="{! Request__c.Items_Requests__r}" var="recc">
            <tr>
                <td>
                    {! itemNum} - {! Request__c.Items_Requests__r[0].Sample__c }
                </td>
                <td>
                    {!recc.Description__c}
                </td>
                <td>
                    {!recc.Sales_Nb__c}
                </td>
                <td>
                    {!recc.Sample__c}
                </td>
                <td>
                    {!recc.Quote__c}
                </td>
                <td>
                    {!recc.Regulatory_Document__c}
                </td>
            </tr>
            <apex:variable var="itemNum" value="{! itemNum+1}"/>
        </apex:repeat>
    </tbody>
</table>

<p>We would also like to thank you for your interest for your trust and confidence in Givaudan and our products.
With our best regards,</p>

<p>GivaudanDirect/Connect team</p>
</div>
</body>
</html>
</apex:page>

 Not conten of this VF Page i am geeting in Apex Class with following way

PageReference CustomerEmailTemplatee = Page.CustomerEmailTemplate;         
                CustomerEmailTemplatee.getParameters().put('id',request.id);
                CustomerEmailTemplatee.getParameters().put('firstName','TestFirstName');
                CustomerEmailTemplatee.getParameters().put('LastName','TestLastName');
                Blob body;       
                body = CustomerEmailTemplatee.getContent(); 
                system.debug('Html Content ----'+body.toString());

 Problem : I am not getting values for related list of Request__c .

Hi friends,

 

I have created a one custom visual force page. i want to make this page as default landing page for customer portal. how can i do this.

 

1. I already created custom tab for this page.

2. Default tab setting on for it.

3. From the profile I have select it as default landing page.

4. I have given privilege for this VF Page and It's controller also...

 

Nothing working out. Please suggest me how to resolve this issue.

Hello Friends, I am getting 1 problem during validation in wizard.

 

What i am doing : 

A. In controller i am having one function namely step2 with return type PageReference.

What it does :

1. Validate the data which is on step1 Form.

2. If Data is validate returns PageReference for next step in wizard.

3.  If Data is not validate returns null to stay on same page.

 

B. In Visual force page I am having

1.   <apex:outputPanel id="errorMsg">

              <apex:outputPanel rendered="{! validate == false}"> My Error Message </apex:outputPanel>

       </apex:outputPanel>

2. <apex:commandButton action{! step2} reRendere="errorMsg">

 

C. Problem :

When data is not validate controller returns null PageReference and my errorMsg outputPanel reRenders and i gets the error. But when  data is validate and function returns PageReference for next page than i am not rendering to Next Page.

I thinks:

Since i have reRender attribute with command button than if function returns next page reference but page stays on same page to rerender the outputPanel. I do not what can be the solution and where exactly i am wrong. Immediate help required.

Hello friends , i am writing a test class. in this test class i need to create a user - for this i wrote following code

User u = new User();
        Profile pf = [Select id, Name from Profile where Name =:'APAC' limit 1];
           system.debug('-------'+pf);
            u.LastName = 'Nicomatic2';
            u.Email = 'test@gmail.com.sandbox';
            u.CompanyName = 'test.com';
            u.Title = 'Test User';
            u.Username = 'test@gmail.com.sandbox';
            u.Alias = 'ni';
            u.CommunityNickname = 'nicomatic21';
            u.TimeZoneSidKey = 'America/Mexico_City';
            u.LocaleSidKey = 'en_US';
            u.EmailEncodingKey = 'ISO-8859-1';
            u.ProfileId = pf.Id;
            u.LanguageLocaleKey = 'en_US';       
            insert u;

 During excecution of this i get's error : Error - INVALID_CROSS_REFERENCE_KEY, invalid cross reference id: [] in insert U; line.

In system.debug line i am geeting profile name and id but still it's not working. But when i put 'standar user' Or 'System Admin' than it works. Why ? 

Hello friends, 

i have following class with test method i want to know how can i get test coverage for catch part. 

public Class AutoCompleteController{
    
    public String[] jsonDescriptionData;
    
    public AutoCompleteController(BrowseCatalog controller) {

    }
    
    public AutoCompleteController(){
    	
    }
    
    public List<string> getjsonDescriptionData(){
        try{
            if(jsonDescriptionData == null){
                jsonDescriptionData = new List<string>();
            }
            else{
                jsonDescriptionData.clear();
            }
            List<Product__c> productDesList = [select id, Name, Default_Sales_Description__c from product__c];
            if(productDesList != null && productDesList.size() != 0){
                Set<String > temp = new Set<String>();
                for(product__c rec : productDesList ){
                    temp.add(rec.Default_Sales_Description__c);
                    temp.add(rec.Name);
                }
                for(String rec : temp){
                    jsonDescriptionData.add('"'+rec+'"');
                }
            }
            return jsonDescriptionData;
        }catch(Exception e){
             ApexPages.addmessage(new ApexPages.message(ApexPages.severity.WARNING,e.getMessage()));
             return null;
        }
    }
    
    public static testMethod void testAutoCompleteController(){
       List<Product__c> proList = new List<Product__c>();
        Product__c pro1 = new Product__c(Name='111', Active__c=true, Alcohol__c=10, Allergen_OK__c='Yes', CAN_TTB_Approved__c='yes', Default_Sales_Description__c = 'Lemon Tea');
        Product__c pro2 = new Product__c(Name='112', Active__c=true, Alcohol__c=10, Allergen_OK__c='Yes', CAN_TTB_Approved__c='yes', Default_Sales_Description__c = 'Lemon Tea');
        proList.add(pro1);
        proList.add(pro2);
        insert proList;
        AutoCompleteController controller = new AutoCompleteController();
        controller.getjsonDescriptionData();
        controller.getjsonDescriptionData();
        BrowseCatalog brocat = new BrowseCatalog();
        AutoCompleteController controller1 = new AutoCompleteController(brocat);
        
    }
}

 

Hello friends,

 

1. I am using some properties on my visualforce page, how can i get test coverage for these properties

2. I am setting the system.test.setCurrentPage(My VF Page) but it's not going through property code.

3. i am mentioning code below for which i want test coverage.

 

 

    public Map<string,Basket__c> productGroupCodeToBasketItem{
        get{
            try{
                if(productGroupCodeToBasketItem == null){
                    productGroupCodeToBasketItem = new Map<string,Basket__c>();
                    for(Basket__c rec : [Select id, product__c,Product__r.Name from Basket__c where createdById =: UserInfo.getUserId()]){
                        productGroupCodeToBasketItem.put(rec.Product__r.Name,rec);//Collectin of all items presetn in basket
                    }
                }  
                return productGroupCodeToBasketItem;
            }catch(Exception e){
                ApexPages.addmessage(new ApexPages.message(ApexPages.severity.WARNING,e.getMessage()));
                return null;
            }
        }
        set;
    }
    
    
    //Current Request for the user
    public Request__c request{
        get{
            try{
                if(request == null){
                   
                    List<Request__c> requestList = [SELECT Id,Attention_to__c,Address_1__c,Address_2__c,Shipping_Zip_Postal_Code__c, Shipping_City__c,Shipping_State_Province__c ,Shipping_Country__c, Is_Agree_With_Terms_and_Conditions__c FROM Request__c WHERE CreatedById =: UserInfo.getUserId() AND Status__c = 'In Progress'];
                    if(! requestList.isEmpty()){
                        request = new Request__c();
                        request = requestList.get(0);
                    }
                    if(request != null){
                        request.Shipping_Zip_Postal_Code__c = acc.Shipping_Zip_Postal_Code__c;
                        request.Shipping_City__c = acc.Shipping_City__c;
                        request.Shipping_State_Province__c = acc.Shipping_State_Province__c;
                        request.Shipping_Country__c = acc.Shipping_Country__c ;
                    }
                }
                return request;
            }catch(Exception e){
                ApexPages.addmessage(new ApexPages.message(ApexPages.severity.WARNING,e.getMessage()));
                return null;
            }
        }
        set;
    }

 

 

 

Hello friends,

 

I have confusion between two things Getter & setter methods and property...........are they same thing or different thing . please write comparison between them.

 

For example - i want to display opportunity against an account in a visual force page.

 

My First Approach : 

public class PrintOpp{
    List<opportunity> oppList;
    
    public List<opportunity> getoppList(){
        if(oppList == null){
            oppList = new List<opportunity>();
            oppList = [select Name,Amount,CloseDate From Opportunity where AccountId =: act.id]; // suppose act is holding account record.
        }    
        return oppList;
    }
}

 another approach :

  

public class PrintOpp{
    public List<opportunity> oppList{
        get{
            if(oppList == null){
                oppList = new List<opportunity>();
                oppList = [select Name,Amount,CloseDate From Opportunity where AccountId =: act.id]; // suppose act is holding account record.
            }    
            return oppList;
        }
        set ;
    }
}

 Today one more confusion arraises to me  when i saw a code  and it's saving also - i used to think in getter setter method get will be followed by varaibale name , But in follwing code get is followed by object name --- please see code below

public class MyCustomController {
public Account acc;
public MyCustomController(){
acc=[select name,id,phone,industry,website,rating,BillingCity,BillingCountry,
ShippingCity,ShippingCountry,AnnualRevenue from Account where id=:Apexpages.currentPage().getParameters().get('id')];
}
public Account getAccount() { // just see get is followed by Object Name i used to think it must be variable name i was accepting it must be only getacc()------- ?????
return acc;
}
public PageReference saveMethod()
{
update acc;
PageReference pf=new apexPages.StandardController(acc).view();
return pf;
}

}

 

what is the maximum limit of extensions in VF page. <apex:page controller="abc" extensions="ext1, ext2, ext3,........ how many we can use ? "

Hi All,

 

I have one scinario. in that scinario I am making a multiple record editing page. Where user can add, Edit , delete multiple records at a time.

I have some of the fields required in that object. Please have a look of following image for better understading : 

 

https://drive.google.com/file/d/0B-kKCGMuue-fdFpqT19YMDhWbEU/edit?usp=sharing

 

I want to know what is the best way to send selected recordIds from the VF Page to the Controller.

 

Hi All,

 

I have one scinario. in that scinario I am making a multiple record editing page. Where user can add, Edit , delete multiple records at a time.

I have some of the fields required in that object. Please have a look of following image for better understading : 

 

https://drive.google.com/file/d/0B-kKCGMuue-fdFpqT19YMDhWbEU/edit?usp=sharing

 

Problems : 

1. suppose user hit on '+' button he will get a new row. But if he want to do undo, by selecting 2nd row and click on '-' sign than also it is asking to enter required field.

2. If i use Immediate or apex:actionregion than selected list is not passing to controller and it showing error please select a row (Which i am thorwing)

 

Can anyone provide best solution for this type of scinario

 

---- Lot of thanks for the help ---

 

 

Hi Friends,

What is the use of return statement here

 

<apex:commandButton action="controllerMethod()" onclick="return javaScriptMethod()" rerender="abc" />

 

Hi Friends,

 

What is the use of return statement here

 

<apex:commandButton action="controllerMethod()" onclick="return javaScriptMethod()" />

 

Hi friends,

 

I have a VF tag like this :

 

<apex:inputtext onkeypress="isEnter(event)" value="{! currentPageNo}" />

 

 

JS like this :

      //To check either Enter key pressed in Page No input text or not.
      function isEnter(event){
          if (event.keyCode == 13){
              jumpOnPage(2);
          }
      }

 Action function is like this :

     <apex:actionFunction name="jumpOnPage" action="{! jumpOnPage}" reRender="mpb">
         <apex:param name="pageNo" value="" assignTo="{! pageNo}"/>
     </apex:actionFunction>

 Problem is : when i am presseing enter the whole page is refreshing not the particular component of page. How to resolve this.

Hi,

 

I am using pageBlockTable to display some values and it is working fine. After that for look and feel i am using Repeat tag and i am calling same method to display the values but it is not working.

 

Is there any difference between PageBlockTable and Repeat. Please clarify me.

 

Thanks,

Bujji

  • April 11, 2013
  • Like
  • 0

Hi Friends,

 

I have multiple currency activate in one organisation. A user fills an amount in different currency. i am using this field, in some calculation in controller. My requirement is that before using this amount field in calculation, it should be converted in to default organisation currecy value. How can i achieve this ?

Hello I am trying to rerender the input inside a panel but its not refreshing the input text but also creating a new input text field.

 

Below is the Controller code which is fetching value and after checking the logs i found the name is properly coming but when displaying it into the input text field its not showing.

 

Controller code :

=========================================================================================

public class toolExtension {         

  public  RecordedTools__c Recordtools; //User sobject   

  public String selectedTool {get;set;}

    public String lname{get;set;}

    public String lookupvalue{get;set;}

    //initializes the private member variable u by using the getRecord method from the standard controller   

// public toolExtension(ApexPages.StandardController stdController) {                   // }   

   public toolExtension(ApexPages.StandardController stdController) {     }   

      public PageReference retrieveVal()     {

        String ipString = changepicklistvalue();         return null;     }   

 

  public string changepicklistvalue()

{

 //system.debug(apexpages.currentpage().getparameters().get('selectedTool'));   

  System.debug('lookup val**'+selectedTool);   

  ToolResponsible__c toolres = [SELECT p.User__c FROM ToolResponsible__c p where p.DTools__c =:selectedTool];     User user=[SELECT p.Name FROM User p where p.id =:toolres.User__c];   

  //System.debug('Val***'+toolres.User__c);    

System.debug('Name***'+user.Name);

  String lname = user.Name;    

//System.debug "Values"+name;   

// System.debug('Name'+name);

     System.debug('Name'+lname);   

  return lname;

}

 

}

 

 

===================================================================================

VF Page :

===================================================================================

<apex:page standardController="User" extensions="toolExtension">     

     <apex:outputText id="NbLoginTool" value="21" rendered="true"/>   

  <apex:messages id="messages" />  

   <script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>

      <script type="text/javascript" >       

    function callonlookup(val) {

    alert('check'+val.value);

           callpicklistmethod(val.value);     }

 

         function loadLoginTool(idGet, idBut, fldTool, nbMax) {    

        $('[id $="lTool22"]').css('display','block');        

   // 'input[id $="fl_Tools_Tool_21"]').val()=$('input[id $="fl_Tools_Tool_21"]').val()+1      

     // 'input[id $="NbLoginTool"]').val()=$('input[id $="NbLoginTool"]').val()+1     

      }     </script>

 

   <apex:form id="FrmTools">   

      <apex:pageBlock >  

      <apex:pageBlockSection id="UserInfo" title="UserInformation">  

     <div id='LoginTool' >

        <TABLE WIDTH="100%" BORDER="1" CELLSPACING="0" CELLPADDING="2">           

    <tr id='lTool21' >  

               <TD VALIGN="Top" COLSPAN="2" ><br></br>   

                  <apex:selectList id="tools1" value="{!selectedTool}" size="1" title="tools" onchange="callonlookup(this)">                   <apex:selectOptions value="{!tools}" ></apex:selectOptions>  

              <apex:actionFunction name="callpicklistmethod" reRender="lpanel1,messages" action="{!retrieveVal}">  <apex:param name="selectedTool" value="{!selectedTool}" assignTo="{!selectedTool}"/> </apex:actionFunction></apex:selectList>

</TD>     

  <apex:outputPanel id="lpanel1" >

      <TD VALIGN="Top" COLSPAN="2" ><br></br>

       <apex:inputText id="fl_Tools_Tool_21" label="hello" value="{!lname}"/>

            </td>     

      </apex:outputPanel>       

       <td><br></br><span id='lToolBut'>

<a class="bouton" style = "cursor:hand" onclick="loadLoginTool('lTool', 'lToolBut', 'NbLoginTool', '30');">Add a Tool</a></span></td> </TR>  

   </TABLE>  

   </div>

</apex:pageBlockSection>

</apex:pageBlock>

    </apex:form>   

</apex:page>

 

===================================================================================

 

==========================================================================================

Hi All,

 

I have recently been doing a requirement with google visualizations. I was successfully get the charts to work for me by plotting the values, but need some help with how the conversion rates would be visible.

 

The Scenario is as below:

 

We have a Corporate Currency - or organization default currency.

 

We have a user default currency on the user Record

 

We have a default currency for every record when Currency feature is enabled in our organization, which is the corporate currency. You may change this value while loading data in bulk or creating via UI.

 

Having said that when a user has data in the USD currency for instance and his personal currency is CHF (swiss franks), when veviews the records we would be able to see USD value as well as in brackets the converted CHF.

 

ex: 1234.45 USD (3673.CHF) ----> This is just an example to show how data is viewed on the detailed page.

 

But in my graph i am able to see it as 1234.45 and no converted values.

 

If someone has worked on this please let me know.

 

TIA.

 

Warm Regards,

Sushupsi

 

I have some requirement, I need to parse CSV in Apex through RegEx.

I am able to parse it successfully using some string functions (split, substring, etc.) but I want to parse it through RegEx.

 

Could any one please help me on RegEx for CSV parsing?