• visulaforce
  • NEWBIE
  • 25 Points
  • Member since 2008

  • Chatter
    Feed
  • 1
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 8
    Questions
  • 17
    Replies
hi all

now what i m doing here i have one string in variable like String s1 = 'salesforce'

now i m firing one quarry

select name from account where name = '"+s1+"' 

and i want to display that account name in to Selectoption component 

u can get better idea from code
Code:
///page code///
<apex:page controller="convert1" tabstyle="lead">
 <apex:selectlist value="{!list}" size="1" required="True">
 <apex:selectoption itemvalue="{!items}"/>

////controller//// 
public class convert1
{
  String s1;
    Lead name;
    public  list<account> getItems() {
    if(name == null)
     name = [select company from lead where id = :ApexPages.currentPage().getParameters().get('id')];
     s1=name.company;
      list<Account> ac = new account[]{};
      ac = [select name from account where name = '"+s1+"'];
      return ac;
      }
}

 
but i cant get into that listbox of selectoptioin component

please advise

Thanks & Regards
Amar joshi
HI,
I am querying a custom object from S-control and Apex class. I  am able query that object succesfully in Apex class but in  S-control  i m getting a error related to permission. Is thre any difference in field accessabilty b/w Apex n S-control.
I have one VF page and a  controller having a method fatching records using third party API and putting records into a map. in VF page m calling this method as action method and map to display records. this VF page is having a output link transferring control to 2nd VF page.  In  2nd  VF page i wanna to use  same map to display same records and dont want to call the method again cos of method's execution time. my question is how to achieve this because VF provides a way to pass parameters but ther is no way to set attributes like setAttributes for jsp/servlet in java.
i have  a number of validation in custom inputfields. I wanna show validation  messages for incorrect input. By using ApexPages.addMessage() i m able to display only one message at a time. Is there any way to show the list of messages same as in salesforce. Pls reply soon
Hi,
I am facing a problem. I wanna prompt a msg to user before deleting a record. I am not able to use apex:commandLink for that cos it should be direct child of apex:form.  so i am using source code in bold  below to delete on apex:ouputLink. in docDeletePage i have written code below. on action init method is getting called n in this method i m deleting that particular record from third party API call. Code is not working and I m not sure this is the right way to do this. Pls suggest me is thre any other way. pls reply soon
 
 
Code:
<apex:page action="{!init}" standardController="Opportunity" extensions="DeleteDocument" tabStyle="Opportunity">
</apex:page>

 
  
 
 
Code:
<apex:page action="{!loginDocMall}" standardController="Opportunity" extensions="ViewDocumentControllerExt"  tabstyle="Opportunity">
<apex:variable var="oid" value="{!$CurrentPage.parameters.id}"/> 
<apex:form >
<apex:pageBlock title="Document">
<apex:pageblockTable value="{!propertyList}" rendered="{!NOT(ISNULL(propertyList))}" var="docProperty" columns="9">
<apex:column >    
    <apex:facet name="header">Action</apex:facet>
    <apex:outputLink value="{!urlFor($Page.docEditPage, null, [sessionid = sessionId, docid = docProperty.docId, oppid = oid])}">Edit</apex:outputLink>&nbsp;
    <apex:outputLink action="return confirmDelete()" value="{!urlFor($Page.docDeletePage, null, [sessionid = sessionId, docid = docProperty.docId, oppid = oid])}">Del</apex:outputLink>&nbsp;
</apex:column>
..................
</apex:pageblockTable>
</apex:pageBlock>
</apex:form>
</apex:page>

 
Code for DeleteDocument
public class DeleteDocument {

    public DeleteDocument(ApexPages.StandardController controller) {

    }
    
    public PageReference init()
    {
        code for delete a record
        ..................

        PageReference pageRef = page form which i called docDeletePage;
        pageRef.setRedirect(true);
        pageRef.getParameters().put('id',oppId);
        //pageRef.getParameters().put('sessionId',sessionId);
        return pageRef;
    }

}

 
Hi,

In the code written below i do have one VF page. this page display list of documents. Each row displayed with three command link for Edit, Delete and View the doc. on action of Edit, View and Delete command link method will get called. I have defined these editDoc, deleteDoc and viewDoc methods in "ViewDocumentControllerExt" controller class. I hav 2 issues with that.

1) when i click on any of commandlink same page is getting refreshed and controlller is not getting transfered to the page in pageRef variable and i dont know wether method is getting called or not cos i no debug is getting displayed.

2) I wanna pass a object as parameter of command link and wanna get this object value in Apex class . how to do that.

Pls provide me solution asap.



<apex:page action="{!loginDocMall}" standardController="Opportunity" extensions="ViewDocumentControllerExt" tabstyle="Opportunity">
<apex:form >
<apex:pageBlock title="Document">
<apex:dataTable value="{!propertyList}" var="docProperty" columns="9">
<apex:column >
<apex:commandLink value="Edit" action={!editDoc}>
<apex:param name="docId" value="{!docProperty.docId}"/>
</apex:commandLink >
</apex:column>
<apex:column >
<apex:commandLink value="View" action="{!viewDoc}">
<apex:param name="docId" value="{!docProperty.docId}"/>
</apex:commandLink>
</apex:column>
<apex:column >
<apex:commandLink action="{!deleteDoc}" value="Del">
<apex:param name="docId" value="{!docProperty.docId}"/>
</apex:commandLink>
</apex:column>
<apex:column value="{!docProperty.category}"/>
<apex:column >
<apex:commandLink value="{!docProperty.title}" />
</apex:column>
<apex:column value="{!docProperty.size}"/>
<apex:column value="{!docProperty.subject}"/>
<apex:column value="{!docProperty.keywords}"/>
<apex:column value="{!docProperty.lastModified}"/>
</apex:dataTable>
</apex:pageBlock>
</apex:form>
</apex:page>




public class ViewDocumentControllerExt
{
private static String sessionId = null;
private final Opportunity opportunity;
private static List<DocProperty> propertyList = new List<DocProperty>();

// The extension constructor initializes the private member
// variable acct by using the getRecord method from the standard
// controller.
public ViewDocumentControllerExt(ApexPages.StandardController stdController) {
this.opportunity = (Opportunity)stdController.getRecord();
}

public List<DocProperty> getPropertyList()
{
return propertyList;
}


public String getSessionId()
{
return sessionId;
}

.........
some more methods here
.........

public PageReference editDoc()
{
String id = System.currentPageReference().getParameters().get('docId');
PageReference pageRef = new PageReference('/apex/docEditPage');
pageRef.setRedirect(true);
return pageRef;
}

public PageReference viewDoc()
{
System.debug('inside viewDoc method');
PageReference pageRef = new PageReference('/apex/docViewPage');
pageRef.setRedirect(true);
return pageRef;
}

public PageReference deleteDoc()
{
System.debug('inside deleteDoc method');
String id = System.currentPageReference().getParameters().get('docId');
PageReference pageRef = new PageReference('/apex/docDeletePage');
pageRef.setRedirect(true);
return pageRef;
}

}

hi,

I do need to upload a file through visualforce page. I found tht thre is no inbuilt control for filedialog in VF. so i have created one but i am not able to use the same in VF page. pls help me with this urgently.



Thanks,
Manjari
plz reply for this asap. Is thre any coding standard for Apex,Visualforce and S-control developement at salesforce site.
Hi,
 
I am creating a visualforce page. m trying to display contact for particular account. but it's throwing compilation error. please check.......
 
error is :
ErrorError: Invalid field 'contacts' for SObject 'Account'.
 
and code 4 visualforce page is:
 
 

<apex:page standardController="Account">

<apex:pageBlock title="Hello {!$User.FirstName}!">

This is {!account.name} account. <p/>

</apex:pageBlock>

<apex:pageBlock title="Contact Detail">

<apex:pageBlockList value="{!Account.Contacts}" var="contact1">

<apex:column value="{!contact1.Name}"/>

</apex:pageBlockList>

</apex:pageBlock>

</apex:page>

 
 
 
dear i made a custom object candidaeinformation with feild; firstname , last name ,password ,phone ,email Error: token error this is for login:controller public class Registration { private string FirstName{get;set}; private string password{get;set}; public String getFirstName() { return this.firstName; } public String getpassword() { return this.password; } public void setFirstName(String FirstName) { this.FirstName = FirstName; } public void setpassword(String FirstName) { this.Password = Password; } list mylogin=[select firstname, password from candidateinformation]; public PageReference save () { for(candidateinformation c: mylogin) { if(c.firstname==firstname && c.password==password) { page.success; } } return null; } } visualforcepage:unknown property firstname >
  • April 15, 2010
  • Like
  • 0

I'm working on some unit test coverage code and currently have 77% of the controller covered.  I'm trying to get the remaining lines covered before adding my assert statements.

 

The lines missing code coverage are in my save() method (see the screenshot below).

 

In my test method, I've initialized the controller and passed in a new instance of the StandardSetController with a list of the sObject being used.  I have called all the properties and methods in the controller.

 

Can anyone provide some help on how I can get the missing lines in my save method covered?  I need to create a new task to use in the save method that is being attached to multiple records.

 

Here is my controller code:

 

public class MassAddActivityController { private List<Service_Delivery__c> sds; private Task assignedTo = new Task(); private Task status = new Task(); private Task activityDate = new Task(); private Task clientAttendees = new Task(); private Task hsgAttendees = new Task(); private Task presenter = new Task(); private Task purpose = new Task(); private Task dynamics = new Task(); private Task outcomes = new Task(); private Task description = new Task(); private Task sendContactReport = new Task(); private Boolean render; private Integer count; public Task task {get; set;} public Task getAssignedTo() { return assignedTo; } public Task getStatus() { return status; } public String subject { get; set; } public Task getActivityDate() { return activityDate; } public Task getClientAttendees() { return clientAttendees; } public Task getHsgAttendees() { return hsgAttendees; } public Task getPresenter() { return presenter; } public Task getPurpose() { return purpose; } public Task getDynamics() { return dynamics; } public Task getOutcomes() { return outcomes; } public Task getDescription() { return description; } public Task getSendContactReport() { return sendContactReport; } public MassAddActivityController(ApexPages.StandardSetController stdSetController) { init((List<Service_Delivery__c>) stdSetController.getSelected()); status.status = 'Completed'; subject = 'Presentation/Meeting'; assignedTo.OwnerId = UserInfo.getUserId(); DateTime dt = System.now(); Date currentDate = date.newinstance(dt.year(), dt.month(), dt.day()); activityDate.activityDate = currentDate; render = false; } public void init(List<Service_Delivery__c> sds) { List<Id> ids = new List<Id>(); for (Service_Delivery__c sd : sds) { ids.add(sd.id); } this.sds = [Select Id, Name From Service_Delivery__c Where Id in :ids]; count = [Select Count() From Service_Delivery__c Where Id in :ids]; } public Id getRecordTypeId() { RecordType rt = [Select Id From RecordType WHERE Name = 'Contact Reports Entry']; Id recordTypeId = rt.Id; return recordTypeId; } public List<Service_Delivery__c> getServiceDeliveries() { return sds; } public List<SelectOption> getItems() { Schema.DescribeFieldResult pklst = Schema.Task.Subject.getDescribe(); List<Schema.PicklistEntry> ple = pklst.getPicklistValues(); List<SelectOption> options = new List<SelectOption>(); for(Schema.PicklistEntry f : ple) { options.add(new SelectOption(f.getLabel(), f.getLabel())); } return options; } public PageReference save() { try { for (Service_Delivery__c sd : sds) { Task t = new Task(); t.recordTypeId = getRecordTypeId(); t.ownerId = assignedTo.OwnerId; t.status = 'Completed'; t.subject = subject; t.activityDate = activityDate.activityDate; t.whatId = sd.Id; t.Client_Company_Attendees__c = clientAttendees.Client_Company_Attendees__c; t.Health_Strategies_Group_Attendees__c = hsgAttendees.Health_Strategies_Group_Attendees__c; t.Meeting_Presenter__c = presenter.Meeting_Presenter__c; t.Purpose__c = purpose.Purpose__c; t.Dynamics__c = dynamics.Dynamics__c; t.Outcomes__c = outcomes.Outcomes__c; t.description = description.description; t.Send_Contact_Report__c = sendContactReport.Send_Contact_Report__c; t.Mass_Added_Date__c = Date.today(); insert t; } ApexPages.Message msg = new ApexPages.message(ApexPages.Severity.INFO, 'Activities added successfully.'); ApexPages.addMessage(msg); render = true; return null; } catch (Exception ex) { ApexPages.Message errMsg = new ApexPages.Message(ApexPages.Severity.ERROR, ex.getMessage()); ApexPages.addMessage(errMsg); return null; } } public boolean getRendered() { return render; } public Integer getCount() { return count; } static testMethod void test() { List<Service_Delivery__c> sds = [Select id, name From Service_Delivery__c LIMIT 5]; MassAddActivityController ctrl = new MassAddActivityController(new ApexPages.StandardSetController(sds)); ctrl.getAssignedTo(); ctrl.getStatus(); ctrl.getActivityDate(); ctrl.getClientAttendees(); ctrl.getHsgAttendees(); ctrl.getPresenter(); ctrl.getPurpose(); ctrl.getDynamics(); ctrl.getOutcomes(); ctrl.getDescription(); ctrl.getSendContactReport(); ctrl.getCount(); ctrl.getRendered(); ctrl.getRecordTypeId(); ctrl.getServiceDeliveries(); ctrl.getItems(); ctrl.save(); } }

 

screenshot

screenshot

Hi,

 

I have a custom object (say 'Project') that has various fields, has child base objects like notes/attachments, activities + has other child custom objects as master-detail relationships (i.e. issues, risks, etc).

 

One of the fields on the Project object is status (i.e. proposed, under work, completed).  

 

I would like it so that when a project status is set to completed, the project & all child objects are made read only.

 

I have tried using record types + making a different page layout that has its fields read only.  Using a workflow, I set the record type that uses this 'read only' page layout when the status is set to completed.  However this has issues in that:

 

-users can still change fields set as read only in the page layout by double-clicking 

-can't seem to not have the 'edit' link appear next to child object entries

-can't seem to hide the new note/attach button

 

Not to mention the added complexities of ensuring record types for each child object are correctly set based on the parent object status change.

 

One other approach I am considering is to use sharing rules:

 

-by default have the project object be private

-have a sharing rule that will grant access to all users in read/write (i.e. if the status of the project is not completed, anybody can read/edit)

 

-upon change of status to completed, have a trigger that will:

>change the owner to a 'admin user' (they will be the only one that can edit it)

>delete existing sharing rule

>add sharing rule to be read only for all users

 

 

I haven't tried to code this so not sure if this will work.

 

Does anybody have any other ideas on how this requirement can be met?

 

 

 

  • February 01, 2010
  • Like
  • 0

Hi  All I am Getting Following Error when try to access custom object in flex . if any bod knows please reply me as soon as possible.

 

Fault from operation: (com.salesforce.results::Fault)#0
  detail = (Object)#1
    fault = (Object)#2
      column = -1
      exceptionCode = "INVALID_TYPE"
      exceptionMessage = "sObject type 'npe5__Affiliation__c' is not supported."
      row = -1
      xsi:type = "sf:InvalidSObjectFault"
  faultcode = "sf:INVALID_TYPE"
  faultstring = "INVALID_TYPE: sObject type 'npe5__Affiliation__c' is not supported."

our salesforce admin added a validation rule on opportunity object and because of which previously working test methods started failing. The validation rule checks if the account has HeadQuarters and its defined as

 

ISNULL( HQ_Account_Region__c)

 

 

When I am trying to move my trigger changes (on a different object), triggers related to opportunity fail because of the above validation rule.

 

here is the test method. can anyone say whats missing here. I have tried adding a HQ_ACCount_region but its a read only field, so I cannot assing any values to it.

 

 

pls.let me know where I am going wrong or how to avoid the error

 

 

testOpportunitySalesGoalSyncTime.testMethodOpportunitySalesGoal System.DmlException: Insert failed. First exception on row 0; first error: FIELD_CUSTOM_VALIDATION_EXCEPTION, The account is missing primary billing address so this opportunity will not be routed properly.  To fix it, please go to the account record and add a primary billing address.: [AccountId]

 

This is the error message the above validatio rulehas

 

The account is missing primary billing address so this opportunity will not be routed properly.  To fix it, please go to the account record and add a primary billing address.: [AccountId]

 

Let me know if you have more questions in order to fix this issue

Download Apex
public class testOpportunitySalesGoalSyncTime {

public static testmethod void testMethodOpportunitySalesGoal() {

/* 09/03/08 changed test to create 4 unique Opportunity_Sales_Goal records */

Account acct = createAccount();

Opportunity newOpportunity1 = createOpportunity(acct);
Opportunity newOpportunity2 = createOpportunity(acct);
Opportunity newOpportunity3 = createOpportunity(acct);
Opportunity newOpportunity4 = createOpportunity(acct);

String salesGoalId1 = getSalesGoalId();
String salesGoalId2 = getSalesGoalId();
String salesGoalId3 = getSalesGoalId();
String salesGoalId4 = getSalesGoalId();

createOpportunitySaleGoal(newOpportunity1,salesGoalId1);
createOpportunitySaleGoal(newOpportunity2,salesGoalId2);
createOpportunitySaleGoal(newOpportunity3,salesGoalId3);
createOpportunitySaleGoal(newOpportunity4,salesGoalId4);

newOpportunity1.Name = 'AAA';
update newOpportunity1;

newOpportunity2.Name = 'BBB';
update newOpportunity2;

newOpportunity3.Name = 'CCC';
update newOpportunity3;

newOpportunity4.Name = 'DDD';
update newOpportunity4;


DateTime currentTime = System.now();
for(Opportunity_Sales_Goal__c opportunitySalesGoal:[Select Id,Last_Sync_To_Parent__c from
Opportunity_Sales_Goal__c where Opportunity__c = :newOpportunity1.Id
or Opportunity__c = :newOpportunity2.Id
or Opportunity__c = :newOpportunity3.Id
or Opportunity__c = :newOpportunity4.Id]) {
System.assertEquals(opportunitySalesGoal.Last_Sync_To_Parent__c.day(),currentTime.day());
System.assertEquals(opportunitySalesGoal.Last_Sync_To_Parent__c.month(),currentTime.month());
System.assertEquals(opportunitySalesGoal.Last_Sync_To_Parent__c.year(),currentTime.year());
System.assertEquals(opportunitySalesGoal.Last_Sync_To_Parent__c.hour(),currentTime.hour());
System.assertEquals(opportunitySalesGoal.Last_Sync_To_Parent__c.minute(),currentTime.minute());
}


}

private static void createOpportunitySaleGoal(Opportunity newOpportunity, String salesGoalId){

//for(Integer i=0; i<4 ; i++){
Opportunity_Sales_Goal__c opportunitySalesGoal = new Opportunity_Sales_Goal__c();
opportunitySalesGoal.Opportunity__c = newOpportunity.Id;
opportunitySalesGoal.Sales_Goal__c = salesGoalId;

DateTime dtTime = DateTime.newInstance(1980,1,1);
opportunitySalesGoal.Last_Sync_To_Parent__c = dtTime;
insert opportunitysalesgoal;
//}

}
private static Opportunity createOpportunity(Account acct){

Opportunity newOpportunity = new Opportunity();
newOpportunity.Name = 'Testing Values';
newOpportunity.Account = acct;
newOpportunity.StageName = 'Qualifying';
newOpportunity.CloseDate = Date.today();

insert newOpportunity;
return newOpportunity;

}
private static Account createAccount(){



Account account = [ Select a.Name from Account a
where a.HQ_Account_Region__c <> null
and A.billingCountry <> Null limit 1];





//Account account = new Account();
//account.Name = 'TestAccount';
//Account.BillingCountry = 'United States';

//insert account;
return account;
}

private static String getSalesGoalId(){

Sales_Goal__c newSalesGoal = new Sales_Goal__c();
newSalesGoal.Description__c = 'Testing Sales Goal';
newSalesGoal.no_Required__c=1;
insert newSalesGoal;
return newSalesGoal.Id;

}
 
}
public 

 

 

 

 

 

 

 

 

 

\

  • September 15, 2009
  • Like
  • 0

Apologies in advance - I know this is a small syntax error, but I can't seem to solve this on my own.  I get a comple error with the following trigger (designed to create new Contract on closed opportunity if a contract does not already exist)

 

Unfortunately I just accidentally closed my browser window where I was writing this, so I don't know the exact error - I just remember it was a compile error on line 3.

 

Any help would be most appreciated!!

 

trigger checkOppty on Opportunity(after update) { private List<Contract> contracts = new List<Contact>(); for (Opportunity o in Trigger.new) { if (o.isClosed && !Trigger.oldMap.get(o.Id).isClosed) { Contract c = new Contract(Name = o.Name); contracts.add(c); } } if (contracts.size() > 0) { insert contracts; } }

 

Hello Everyone,

 

I created a formula on the opportunity object so that I could use it in a report; however, the only way that the new formula field is visible in a report is if I make it visible on the page layout (form not report)!  This is totally off the charts for me since I am more familiar with MS Access reports.  MS Acces reports tie directly to a table or query and never to a form.  For one I do not want the formula field visible on the page layout and two I cannot seem to hide it.

 

In addition, in the Enterprise version there are multiple layout capabilities so will this mean that I will have to make a formula field visible on all layouts just to get it to show on a report?

 

Why would SF create such a strange way of using formulas to reports or am I missing something as usual? :)

 

Thanks

Hi,

 

I have a method which is marked as future which is being called from 2 triggers. But when executed in production I get the following error:

 

Failed to invoke future method 

 

caused by: System.AsyncException: Future method cannot be called from a future method:

 

 

Is this a case of recursion? I am not sure what the exact error is and how would I go about fixing this

 

Thanks

Gita 

 

  • August 11, 2009
  • Like
  • 0

We have a trigger that does some basic geographic cleansing (e.g., mapping country abbreviation "US" to international territory "AMER", mapping U.S.A to US, etc.).

 

The trigger relies on a utility class that initializes a set of lookup tables.  For example...

 

    Map<String, String> CountryAbbreviationToInternationalTerritoryMap = new Map<String, String>();
         
    CountryAbbreviationToInternationalTerritoryMap .put('BI', 'EMEA');
    CountryAbbreviationToInternationalTerritoryMap .put('KM', 'EMEA');

    ...

 

Because there are a large number of entries to initialize the table with, we run into the "too many script statements" governor limit when this utility class is invoked from a trigger.

 

Is there a best practices for initializing a lookup table that doesn't require a lot of script statements?

 

 ~Bob


 

 

 

I wrote a trigger to send an email but I dont know how to make it send field values from the new lead in the email body...Any help?

trigger mhform on Lead (after insert) {
Messaging.SingleEmailMessage mail= new Messaging.SingleEmailMessage();
String[] toAddresses = new String[]{'margiro@piab.com'};
mail.setToAddresses(toAddresss);
mail.setReplyTo('support@acme.com');
mail.setSenderDisplayName('Piab Support');
mail.setSubject('New Conveyor Order');
mail.setBccSender(false);
mail.setUseSignature(false);\

String msg = 'new conveyor ordered';

mail.setHtmlBody(msg);

Messaging.sendEmail(new Messaging.SingleEmailMessage[] { mail});
}

Hi,
 
The problem I m facing must be solved by so many developers.
 
I m trying to set public variable value in apex class from VF page.
VF Page uses StandardCotroller and that apex class as an extension
 
but that public variable not being set...  :womansad:
 
I need proper guidence....  :womanindifferent:
 
here is the source code:  VF Page
 
<apex:inputText id="clientid" value="{!clientId}"/>

Apex Class
 
public class PointOfSale
{
    public ID clientId;

    public ID getclientId()
    {
        return clientId;
    }
    public void setclientId (ID txt)
    {
        clientId = txt;
    }

    private final POS__c pos;
   
    public PointOfSale (ApexPages.StandardController controller)
    {
        this.pos = (POS__c)controller.getRecord();
    }
}
 
Is it becoz m using this class as extension?
 
Any Idea/Sugession/ help ???
 
 
Thanks
 

 
hi all

now what i m doing here i have one string in variable like String s1 = 'salesforce'

now i m firing one quarry

select name from account where name = '"+s1+"' 

and i want to display that account name in to Selectoption component 

u can get better idea from code
Code:
///page code///
<apex:page controller="convert1" tabstyle="lead">
 <apex:selectlist value="{!list}" size="1" required="True">
 <apex:selectoption itemvalue="{!items}"/>

////controller//// 
public class convert1
{
  String s1;
    Lead name;
    public  list<account> getItems() {
    if(name == null)
     name = [select company from lead where id = :ApexPages.currentPage().getParameters().get('id')];
     s1=name.company;
      list<Account> ac = new account[]{};
      ac = [select name from account where name = '"+s1+"'];
      return ac;
      }
}

 
but i cant get into that listbox of selectoptioin component

please advise

Thanks & Regards
Amar joshi
I have a page that dynamically returns results to several different tables but I only want these tables to be rendered if they contain values. I would like to put this logic in the page if possible as there are 10 tables and I'd rather not build out 10 methods in the controller if I can do this one a simple line of code in the page.

Here is what I have tried but with no luck. With this code the table is never rendered and I'm not even sure if I can user the .size() method here....

Code:
<apex:pageBlockTable value="{!results}" var="r" rendered="{IF(!results.size() > 0,true,false)}">

Thanks,
Jason


Message Edited by TehNrd on 08-26-2008 10:25 AM
  • August 26, 2008
  • Like
  • 0
Hi,

Can we set focus to particular part of screen while page loading.
Any pointer on this highly appreciatable.

Thanks
Srini
Hi,

In the code written below i do have one VF page. this page display list of documents. Each row displayed with three command link for Edit, Delete and View the doc. on action of Edit, View and Delete command link method will get called. I have defined these editDoc, deleteDoc and viewDoc methods in "ViewDocumentControllerExt" controller class. I hav 2 issues with that.

1) when i click on any of commandlink same page is getting refreshed and controlller is not getting transfered to the page in pageRef variable and i dont know wether method is getting called or not cos i no debug is getting displayed.

2) I wanna pass a object as parameter of command link and wanna get this object value in Apex class . how to do that.

Pls provide me solution asap.



<apex:page action="{!loginDocMall}" standardController="Opportunity" extensions="ViewDocumentControllerExt" tabstyle="Opportunity">
<apex:form >
<apex:pageBlock title="Document">
<apex:dataTable value="{!propertyList}" var="docProperty" columns="9">
<apex:column >
<apex:commandLink value="Edit" action={!editDoc}>
<apex:param name="docId" value="{!docProperty.docId}"/>
</apex:commandLink >
</apex:column>
<apex:column >
<apex:commandLink value="View" action="{!viewDoc}">
<apex:param name="docId" value="{!docProperty.docId}"/>
</apex:commandLink>
</apex:column>
<apex:column >
<apex:commandLink action="{!deleteDoc}" value="Del">
<apex:param name="docId" value="{!docProperty.docId}"/>
</apex:commandLink>
</apex:column>
<apex:column value="{!docProperty.category}"/>
<apex:column >
<apex:commandLink value="{!docProperty.title}" />
</apex:column>
<apex:column value="{!docProperty.size}"/>
<apex:column value="{!docProperty.subject}"/>
<apex:column value="{!docProperty.keywords}"/>
<apex:column value="{!docProperty.lastModified}"/>
</apex:dataTable>
</apex:pageBlock>
</apex:form>
</apex:page>




public class ViewDocumentControllerExt
{
private static String sessionId = null;
private final Opportunity opportunity;
private static List<DocProperty> propertyList = new List<DocProperty>();

// The extension constructor initializes the private member
// variable acct by using the getRecord method from the standard
// controller.
public ViewDocumentControllerExt(ApexPages.StandardController stdController) {
this.opportunity = (Opportunity)stdController.getRecord();
}

public List<DocProperty> getPropertyList()
{
return propertyList;
}


public String getSessionId()
{
return sessionId;
}

.........
some more methods here
.........

public PageReference editDoc()
{
String id = System.currentPageReference().getParameters().get('docId');
PageReference pageRef = new PageReference('/apex/docEditPage');
pageRef.setRedirect(true);
return pageRef;
}

public PageReference viewDoc()
{
System.debug('inside viewDoc method');
PageReference pageRef = new PageReference('/apex/docViewPage');
pageRef.setRedirect(true);
return pageRef;
}

public PageReference deleteDoc()
{
System.debug('inside deleteDoc method');
String id = System.currentPageReference().getParameters().get('docId');
PageReference pageRef = new PageReference('/apex/docDeletePage');
pageRef.setRedirect(true);
return pageRef;
}

}

Hi,
 
I am creating a visualforce page. m trying to display contact for particular account. but it's throwing compilation error. please check.......
 
error is :
ErrorError: Invalid field 'contacts' for SObject 'Account'.
 
and code 4 visualforce page is:
 
 

<apex:page standardController="Account">

<apex:pageBlock title="Hello {!$User.FirstName}!">

This is {!account.name} account. <p/>

</apex:pageBlock>

<apex:pageBlock title="Contact Detail">

<apex:pageBlockList value="{!Account.Contacts}" var="contact1">

<apex:column value="{!contact1.Name}"/>

</apex:pageBlockList>

</apex:pageBlock>

</apex:page>