-
ChatterFeed
-
0Best Answers
-
0Likes Received
-
0Likes Given
-
4Questions
-
4Replies
Constructor not defined: [ApexPages.StandardController].<Constructor>(Id)
Hi Everyone,
I am new to test classes.I tried all suggestions but stil it shows the same error.
public class fileAttachToMultipleRecordsController{ Public Attachment myfile; Public String VMfileName{get;set;} public String ContactIds{get;set;} public Contact con{get;set;} public List<Contact> contacts{get;set;} public fileAttachToMultipleRecordsController(){ contacts= new List<Contact>(); con= new Contact(); } Public Attachment getmyfile() { myfile = new Attachment(); return myfile; } public fileAttachToMultipleRecordsController(ApexPages.StandardController controller) { ContactIds= ApexPages.currentPage().getParameters().get('array'); } Public Pagereference Savedoc() { if(ContactIds!= null || ContactIds!= ''){ List<String> strConIds= ContactIds.split(','); for(Id conId:strConIds){ Attachment a = new Attachment(parentId =conId,name=myfile.name, body = myfile.body); insert a; VMfileName=a.Name; Task newTask = new Task(Description = 'Attached a file under the attachment sections',Priority = 'Normal',Subject ='Attached a File'+'-'+VMfileName,Status='Completed', ActivityDate=System.today(), whoid=conId); Insert newTask; } } PageReference pf=new PageReference('/003/o'); return pf; } @isTest(SeeAllData=true) public static void testfileAttachToMultipleRecordsController(){ String ContactIds; PageReference pr = Page.fileAttachToMultipleRecords; test.setCurrentPage(pr); fileAttachToMultipleRecordsController ftmr= new fileAttachToMultipleRecordsController(); ftmr.getmyfile(); ftmr.Savedoc(); Contact c=new Contact(); c.LastName='Test Name'; insert c; Contact c1=new Contact(); c1.LastName='Test Name1'; insert c1; ApexPages.StandardController controller = new ApexPages.StandardController(c.id); Attachment a = new Attachment(parentId =c.id,name='test Name'); insert a; String VMfileName='test name'; Task newTask = new Task(Description = 'Attached a file under the attachment sections',Priority = 'Normal',Subject ='Attached a File'+'-'+VMfileName,Status='Completed', ActivityDate=System.today()); Insert newTask; } }
-
- Prasanna1838
- November 22, 2012
- Like
- 0
- Continue reading or reply
How to use For loop(using list) to display various values for each record in a pageblocktable
I have created a page which performs a search and displays the matching records using List by a pageblocktable.
Along with the records names,I need to show some dummy percentage values assoicated to these records.I tried displaying the data using for loop,but all the records are getting displayed with same percentage.
<apex:column headerValue="Account"> <apex:outputLink value="/{!a.Id}" target="_blank">{!a.Name}</apex:outputLink> {!percentage} % Match </apex:column>
I have created accList which performs my search
Public Integer percentage{get;set;}
for(Account acc:accList) { percentage=78; }
. How to display different values for each record using pageblocktable.
Thanks,
prasanna
-
- Prasanna1838
- September 17, 2012
- Like
- 0
- Continue reading or reply
How to open a VF page which is embedded in a button on a new sub tab in service cloud console.
-
- Prasanna1838
- September 13, 2012
- Like
- 0
- Continue reading or reply
SOSL on case object -search on 4 fields
-
- Prasanna1838
- September 10, 2012
- Like
- 0
- Continue reading or reply
Constructor not defined: [ApexPages.StandardController].<Constructor>(Id)
Hi Everyone,
I am new to test classes.I tried all suggestions but stil it shows the same error.
public class fileAttachToMultipleRecordsController{ Public Attachment myfile; Public String VMfileName{get;set;} public String ContactIds{get;set;} public Contact con{get;set;} public List<Contact> contacts{get;set;} public fileAttachToMultipleRecordsController(){ contacts= new List<Contact>(); con= new Contact(); } Public Attachment getmyfile() { myfile = new Attachment(); return myfile; } public fileAttachToMultipleRecordsController(ApexPages.StandardController controller) { ContactIds= ApexPages.currentPage().getParameters().get('array'); } Public Pagereference Savedoc() { if(ContactIds!= null || ContactIds!= ''){ List<String> strConIds= ContactIds.split(','); for(Id conId:strConIds){ Attachment a = new Attachment(parentId =conId,name=myfile.name, body = myfile.body); insert a; VMfileName=a.Name; Task newTask = new Task(Description = 'Attached a file under the attachment sections',Priority = 'Normal',Subject ='Attached a File'+'-'+VMfileName,Status='Completed', ActivityDate=System.today(), whoid=conId); Insert newTask; } } PageReference pf=new PageReference('/003/o'); return pf; } @isTest(SeeAllData=true) public static void testfileAttachToMultipleRecordsController(){ String ContactIds; PageReference pr = Page.fileAttachToMultipleRecords; test.setCurrentPage(pr); fileAttachToMultipleRecordsController ftmr= new fileAttachToMultipleRecordsController(); ftmr.getmyfile(); ftmr.Savedoc(); Contact c=new Contact(); c.LastName='Test Name'; insert c; Contact c1=new Contact(); c1.LastName='Test Name1'; insert c1; ApexPages.StandardController controller = new ApexPages.StandardController(c.id); Attachment a = new Attachment(parentId =c.id,name='test Name'); insert a; String VMfileName='test name'; Task newTask = new Task(Description = 'Attached a file under the attachment sections',Priority = 'Normal',Subject ='Attached a File'+'-'+VMfileName,Status='Completed', ActivityDate=System.today()); Insert newTask; } }
- Prasanna1838
- November 22, 2012
- Like
- 0
- Continue reading or reply
Include vf page in Home Page Components
Hi All,
I need to add vf components in Customer Portal Home Page layout. Please see below my code
HTML Link:
<iframe src="/apex/Custom_Home" frameborder="0" width="100%"></iframe>
Vf page:
<apex:page ">
<c:newsTopics />
</apex:page>
Vf component:
<apex:component controller="CustomerPortalStartPageController">
<apex:pageBlock title="Top 5 Topics" >
<apex:pageBlockTable value="{!newsTopics}" var="top5">
<apex:column>
<apex:outputLink value="{!news.Article_URL__c}">{!news.Title__c}</apex:outputLink>
</apex:column>
</apex:pageBlockTable>
</apex:pageBlock>
</apex:component>
However, when i see home page, its just showing the iframe code..not actual vf page.
Any suggestions?
Regards,
R
- Ranjith Punneli
- October 11, 2012
- Like
- 0
- Continue reading or reply
How to use For loop(using list) to display various values for each record in a pageblocktable
I have created a page which performs a search and displays the matching records using List by a pageblocktable.
Along with the records names,I need to show some dummy percentage values assoicated to these records.I tried displaying the data using for loop,but all the records are getting displayed with same percentage.
<apex:column headerValue="Account"> <apex:outputLink value="/{!a.Id}" target="_blank">{!a.Name}</apex:outputLink> {!percentage} % Match </apex:column>
I have created accList which performs my search
Public Integer percentage{get;set;}
for(Account acc:accList) { percentage=78; }
. How to display different values for each record using pageblocktable.
Thanks,
prasanna
- Prasanna1838
- September 17, 2012
- Like
- 0
- Continue reading or reply
How to open a VF page which is embedded in a button on a new sub tab in service cloud console.
- Prasanna1838
- September 13, 2012
- Like
- 0
- Continue reading or reply