• sonaperth
  • NEWBIE
  • 0 Points
  • Member since 2009

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 6
    Questions
  • 7
    Replies

hi guys, i need some help.

im trying to make a visualforce page that can do filtering and searching.

 

the interface looks like this:

 

 

 

can anyone tell me how to create the 'Location' picklist at the top to filter the list, and how to pass the picklist value into the controller?

or maybe a link or an article or something that i can read to solve this?

 

it should filter the list to just show classes that taking place in that location.

i made it using apex:inputField to make the screenshot, and im confuse on how to pass the value into controller.

 

the values inside the picklist should have the same value with the 'Location' field, as 'Location' field is using Picklist as Datatype.

 

and im planning to just rerender the 'Data' pageBlock rather than rerender the whole page.

 

any help would be greatly appreciated.

hi guys, i have difficulties on making a test class for the getContact() method.

can anyone help me or give me an example?

this is the class:

 

 

public class OpportunityQuotationPrintPdf_Extension {
private final Opportunity opportObj;

private string opportId = System.currentPageReference().getParameters().get('id');

private Id contactId;

private Contact theContact;

public OpportunityQuotationPrintPdf_Extension(ApexPages.StandardController stdController) {
this.opportObj = (Opportunity)stdController.getRecord();
}

public Contact getContact() {
OpportunityContactRole[] listOfOpport = [SELECT Id, ContactId FROM OpportunityContactRole
WHERE OpportunityId = :opportId
AND IsPrimary = true limit 1];
if (!listOfOpport.isEmpty()) {
contactId = listOfOpport[0].ContactId;
theContact = [SELECT Id, Name FROM Contact WHERE Id = :contactId];
return theContact;
}
else {
theContact = [SELECT Id FROM Contact WHERE FirstName like 'Epi'];
return theContact;
}
}
}

 

 and this is my attempt:

 

 

static TestMethod void testOpportunityQuotationPrintPdf_Extension() {

Opportunity testOpportObj = [SELECT Id FROM Opportunity WHERE Opportunity_Number__c = 'OPP-0098'];

PageReference pageR = new PageReference('/apex/OpportunityQuotationPrintPdf_Extension');
ApexPages.currentPage().getParameters().put('id', testOpportObj.Id);
Test.setCurrentPage(pageR);

ApexPages.StandardController standardC = new ApexPages.StandardController(testOpportObj);
OpportunityQuotationPrintPdf_Extension myOpportunity = new OpportunityQuotationPrintPdf_Extension(standardC);

Contact contactTest = [SELECT Id FROM Contact WHERE FirstName like 'Epi'];
Contact contactReal = myOpportunity.getContact();
System.assertEquals(contactReal, contactTest);
}
}

 

the getContact() method is running normally when i call it from the visualforce page ---> {!contact.Name}  if i want to get the Name of the contact.

but i am struggling to get a good 100% coverage test method.

it always go to the 'else' whenever i call it from my test method.

i have tried to make a new opportunity object, new contact object, and new opportunitycontactrole object and not using the current exist data like the code above, but still it did not work.

 

can anyone help me?

thanks in advance.

 

 

hi guys,

how to attach a pdf file to 'notes & attachments' part of an object?

i was able to generate a pdf file using the visualforce with a custom controller.

then they ask to automatically generate and Attach the pdf file to the 'notes & attachment' as well when you press the custom 'buttons and links'.

all i can find is how to attach it to email.

can anyone help? thanks in advance.

 

 

hi guys, i need some help.

 

i need to pass a list of objects from the apex class to visualforce page.

so far, after searching around,  i can only find <apex:dataTable> and <apex:pageBlockTable> to display the objects in a table.

so for example:

 

 

public List<Contact> getContacts() {

contactObjs = [SELECT name, address, phone from Companies

where id = :System.currentPageReference().getParameters().get('id')];

return contactObjs;

}

 

 

 

then if i want to display it in a nice table i can easily use something like this:

 

 

<apex:pageBlock>

<apex:pageBlockTable value="{!Contacts}" var="con">

<apex:column value="{!con.name}" />

<apex:column value="{!con.address}" />

<apex:column value="{!con.phone}" />

</apex:pageBlockTable>

</apex:pageBlockTable>

 

 

but how if i want to display those objects like this:

 

name: qwer

address: qwer

phone: 123

 

name: asdf

address: asdf

phone 456

 

 

can anyone help me please? or tell me which documentation/pdf file should i read

thanks in advance.

hi guys!

how to set default value for a picklist based on which user is logging in?

so if i have 3 users A B C, and picklist "First" "Second" "Third".

when user A login, "First" will be the default value. 

when user B login, "Second" will be the default value. 

when user C login, "Third" will be the default value.

thanks in advance, much appreciated! 

hi guys, im very new in salesforce, i have just done reading the force.com_developer guide.

and i got a question.

 

if i have 2 objects:

1. course, fields = id, name, duration.

2. class, fields = courseName(course lookup), duration, startDate, endDate

 

and when i create a new class, after i choose the course using the lookup button,

i want to grab the duration of the course as well and put it in the class.duration field before clicking the Save button, just doing it on the interface level if i may say.

can anyone help me?

or maybe a suggestion which guide should i read next after the first one?

 

thanks in advance.

hi guys, i need some help.

im trying to make a visualforce page that can do filtering and searching.

 

the interface looks like this:

 

 

 

can anyone tell me how to create the 'Location' picklist at the top to filter the list, and how to pass the picklist value into the controller?

or maybe a link or an article or something that i can read to solve this?

 

it should filter the list to just show classes that taking place in that location.

i made it using apex:inputField to make the screenshot, and im confuse on how to pass the value into controller.

 

the values inside the picklist should have the same value with the 'Location' field, as 'Location' field is using Picklist as Datatype.

 

and im planning to just rerender the 'Data' pageBlock rather than rerender the whole page.

 

any help would be greatly appreciated.

hi guys,

how to attach a pdf file to 'notes & attachments' part of an object?

i was able to generate a pdf file using the visualforce with a custom controller.

then they ask to automatically generate and Attach the pdf file to the 'notes & attachment' as well when you press the custom 'buttons and links'.

all i can find is how to attach it to email.

can anyone help? thanks in advance.

 

 

hi guys, i need some help.

 

i need to pass a list of objects from the apex class to visualforce page.

so far, after searching around,  i can only find <apex:dataTable> and <apex:pageBlockTable> to display the objects in a table.

so for example:

 

 

public List<Contact> getContacts() {

contactObjs = [SELECT name, address, phone from Companies

where id = :System.currentPageReference().getParameters().get('id')];

return contactObjs;

}

 

 

 

then if i want to display it in a nice table i can easily use something like this:

 

 

<apex:pageBlock>

<apex:pageBlockTable value="{!Contacts}" var="con">

<apex:column value="{!con.name}" />

<apex:column value="{!con.address}" />

<apex:column value="{!con.phone}" />

</apex:pageBlockTable>

</apex:pageBlockTable>

 

 

but how if i want to display those objects like this:

 

name: qwer

address: qwer

phone: 123

 

name: asdf

address: asdf

phone 456

 

 

can anyone help me please? or tell me which documentation/pdf file should i read

thanks in advance.

hi guys, im very new in salesforce, i have just done reading the force.com_developer guide.

and i got a question.

 

if i have 2 objects:

1. course, fields = id, name, duration.

2. class, fields = courseName(course lookup), duration, startDate, endDate

 

and when i create a new class, after i choose the course using the lookup button,

i want to grab the duration of the course as well and put it in the class.duration field before clicking the Save button, just doing it on the interface level if i may say.

can anyone help me?

or maybe a suggestion which guide should i read next after the first one?

 

thanks in advance.

Hello,

 

        I am generating PDF using Visualforce for costom object. My custom object contains many lookup fields.

I have a page which has one or more lookup fields of the object. I am using outputField tag of apex to display the value of the lookup fields. The page is getting rendered with values in PDF but the hyperlink is also rendered.

i need the help to supress the underline. But  in HTML using stylesheet, I can supress underline but for PDF I am not able to supress. Is there any way to remove the underline for Lookup fields in PDF?

 

Any kind of help would be greatly appreciated. Please let me know your thoughts.

 

Thanks in advance.