• Prasanna1838
  • NEWBIE
  • 0 Points
  • Member since 2012

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 4
    Questions
  • 4
    Replies
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; } }

 

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

 

I have written a VF page which performs search functionality on click of button.I want to open this page in a new sub tab in a Service cloud console on click of this button. Also ,When it returns records based on search,I need to open the records in another sub tab.I have done this in SF platform and its working fine but I am not sure on how to use this is Service cloud console..Is there any extra code that is needed to be added in here. Thanks! Prasanna
Hi Everyone, I have 4 custom fields(Type,Route,Area,category) on "case" object of pick list data type.I need to write a SOSL on this case object to search the cases with the values in this fields. Can anyone help me out on how to write a search on all these fields?? Thanks, Prasanna
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; } }

 

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>&nbsp;

 

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

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

 

I have written a VF page which performs search functionality on click of button.I want to open this page in a new sub tab in a Service cloud console on click of this button. Also ,When it returns records based on search,I need to open the records in another sub tab.I have done this in SF platform and its working fine but I am not sure on how to use this is Service cloud console..Is there any extra code that is needed to be added in here. Thanks! Prasanna