• Naishadh
  • NEWBIE
  • 431 Points
  • Member since 2007

  • Chatter
    Feed
  • 16
    Best Answers
  • 1
    Likes Received
  • 0
    Likes Given
  • 31
    Questions
  • 250
    Replies

Hi

 

I am retrieving data by consuming a webservice and displaying it in the visual force page using the page block table. I need to sort the records based on the date. Can anyone guide me to achieve this requirement.

 

Thanks in advance

Hi

i just meet one question, when i convert the string to integer type. i used the integer.valueof() method . but if string like 'ABCDEF' that can't  do integer conversion but throw System.TypeException.

could i do judgement first first? like if the string parameter s='123'  can do integer conversion, and then i call the integer.valueof(s)

is there any method ??

 

 

 

I'm using this javascript to collapse a pageBlocktable in Visualforce and it works great in all browsers but IE.  Does anyone know of something I could do to fix that issue.  Here is my code:

 

<script>

var contentArray = new Array();

var idArray = new Array();

var isCollapsed = false;

 

function collapse(ids){

if (isCollapsed) {

fix();

return;

}

isCollapsed = true;

idArray = ids.split(',');

for (var i = 0; i < idArray.length; i++) {

contentArray[i] = document.getElementById(idArray[i]).innerHTML;

document.getElementById(idArray[i]).innerHTML = '';

}

}

 

function fix(){

isCollapsed = false;

for (var i = 0; i < idArray.length; i++) {

document.getElementById(idArray[i]).innerHTML = contentArray[i];

}

}

</script>

I want get a js date control for my inputFiled and I know the salesforce has own js date control ,but I do't  konw hao can I get it,so I hope you can tell me hao to do it, thanks!!!

Hello,


I actually have two questions around apex code.

 

  1. Suppose I want to turn off or delete my apex class, how do I go about doing that in production?  I do not see a way to deactivate or delete the code?
  2. Prior to installing the DupeBlocker 2.0 application in the Sandbox my code was at 89% code coverage but after I installed the third party application it dropped to 23%!  I see that SFDC is using some of the DupBlocker code classes that are firing when I run my test script.  What will I do to get around this because once I install DupeBlock into production I will be faced with this kind of mishap all the time!!!

Hi,

 

I am stuck with developing a testmethod for email to apex.

I tried to follow the example but to no luck.

 

What my email to apex does is:

 

1) after receiving the email , which is of following format:

Firstname : test

lastname : test

e-mail address : test@test.com

 

2) i check if there is already a existing contact using email address

3) if there is a matching email address, i shall go and create a new task to that matched contact.

4) If no match is found i shall create a contact and then create a ceate a new task to that contact.

 

Can any one help me with the test method.

 

for code , pls look at this link:

http://community.salesforce.com/t5/Apex-Code-Development/Email-to-Apex-Test-method/td-p/181756

 

sorry for duplicate post, but need help on this.

 

Thanks,

Sales4ce

Hi,

 

I am developing email to apex functionality for my use case and was able to develop.

But what i am stuck with is the Test method. I have tried to follow some examples from book but no luck as the test method does not compile. Can anybody help me with this.

 

What my Email to apex does:

 

It reads and email, which is of this format(In Red):

 

First Name : Dave

Last name : Williams

E-mail Address : dwilliams@test.com

 

it reads the values and then creates a contact if there is no contact ( i do the checking based on the email).

After a contact is created, it creates an associated task.

Incase, we find a contact, then we create a task to that contact itself.

 

Below is My apex code:

 

global class ProcessApplicants implements
Messaging.InboundEmailHandler
{

    contact[] mycontact=new contact[0];
    
    global Messaging.InboundEmailResult handleInbo undEmail
    (Messaging.InboundEmail email,Messaging.Inboun dEnvelope env)
    {
        Messaging.InboundEmailResult result = new  Messaging.InboundEmailresult();
        string emailaddress=env.fromaddress;
        string e_Subject=email.Subject;
        string[] emailbody=email.plainTextBody.spl it('\n',0);
        string fname=emailbody[0].substring(12);
        string lname=emailbody[1].substring(11);
        string c_email=emailbody[2].substring(16);
        Datetime start_time=Datetime.Now();
        Datetime end_time=start_time.addhours(2);
        
        Contact inserted_Contact;
        contact existing_Contact;
                
        System.Debug('Email address after substrin g =='+c_email);
        try
        {
            //Contact[] existing_Contacts=[Select  Id,email from Contact where email=:c_email limit 1 ];
            existing_Contact=[Select Id from Conta ct where email=:c_email limit 1];
            //existing_Contact=existing_Contacts[0 ];
            system.debug('Contact Id=='+existing_C ontact.Id);
            if(e_Subject=='Registration Day')
            {
                Task[] myTask=new Task[0];
                myTask.add(new Task(Description='T esting Purpose',Subject='Make a Call',Priority='No rmal',Status='Not Started',WhoId=existing_Contact. Id));
                insert myTask;
             }
             else
             {
                 Event[] myEvent=new Event[0];
                 myEvent.add(new Event(Subject='Ju nior Day',WhoId=existing_Contact.Id,EndDateTime=en d_time,StartDateTime=start_time));
                 insert myEvent;
             }
        }
        
        catch(exception ex)
        {
            try
            {
              mycontact.add(new contact(FirstName= fname,LastName=lname,email=c_email));
              insert mycontact;
              inserted_Contact=mycontact[0];
          
              System.Debug('Contact Id_New=='+inse rted_Contact.Id);
              if(e_Subject=='Registration Day')
              {
                  Task[] myTask= new Task[0];
                  myTask.add(new Task(Description= 'Testing Purpose',Subject='Make a Call',Priority=' Normal',Status='Not Started',WhoId=inserted_Contac t.Id));
                  insert myTask;
              }
              else
              {
                 Event[] myEvent=new Event[0];
                 myEvent.add(new Event(Subject='Ju nior Day',WhoId=inserted_Contact.Id,EndDateTime=en d_time,StartDateTime=start_time));
                 insert myEvent;
              }
            }
        
            Catch(DMLException e)
            {
                System.Debug('Error in creating co ntact:'+e);
            }
         }
         
         
         
        
                                                                                                                                                
return result;
}
}

 

Here is My test method:

 

Static testMethod void testTasks()
    {
        Messaging.InboundEmail email = new Messagi ng.InboundEmail();
        Messaging.InboundEnvelope env = new Messag ing.InboundEnvelope();

        email.plainTextBody='Test, Last, TLast@email.com, july 2010';
        email.fromaddress='Sales4ce@gmail.com ';
        email.Subject='Registration Day';
        string[] emailbody=email.plainTextBody.spl it(',',0);
        string fname=emailbody[0];
        string lname=emailbody[1];
        string c_email=emailbody[2];
        string grad_day=emailbody[3];

 

This is the error msg:

Compile Error: Method does not exist or incorrect signature: [SOBJECT:Task].handleInboundEmail(Messaging.Inboun dEmail, Messaging.InboundEnvelope) at line 94 column 8

 

This test method is included with in the same class above.

 

Thanks,

Sales4ce

Hello,

 

I wrote the following trigger to prevent deletion of a Closed Won Opportunity:

 

 


trigger CannotDeleteClosedWon on Opportunity (before delete) 

{

    if(system.Trigger.isDelete)

    {

    for (Opportunity Opps : trigger.new)

         if (Opps.StageName == 'Closed Won')

            {

            Opps.addError('Cannot delete a Closed Won Opportunity');

            }

    }




}

 

The problem, I keep getting sent to a page with the following message:

 

CannotDeleteClosedWon: execution of BeforeDelete

caused by: System.NullPointerException: Attempt to de-reference a null object

Trigger.CannotDeleteClosedWon: line 5, column 29

 

Any suggestions?

  • November 20, 2009
  • Like
  • 0

In my afterinsert trigger  on Lead , I want to update one of the fields in the current Lead records being inserted .I cannot do this in before insert since Iam dependent on the ID's of the newly inserted leads .

 

Getting the below error-

 

LeadTrigger: execution of AfterInsert caused by: System.DmlException: Update failed. First exception on row 0 with id 00QT0000005JQ05MAG;

first error: UNABLE_TO_LOCK_ROW, unable to obtain exclusive access to this record: []

 

any one encountered this issue?

Hi, I am a newbie to Salesforce.com customization, we are working on a prototype and would like to know if it is possible to develop a page using Visual force that does not have the standard left menu panel and standard top menu.

 

We would use this page for integrating with another application. The ideal user experience would be to display a salesforce page in the native application.

 

For example: If a user clicks on CRM link for an account in the native application we should be able to display the account screen rendered in Salesforce.com and this screen should not have the standard tabs menu and left panel menu. User should be able to see only the CRM information pertaining to the selected account. User would not be able to navigate to any other account  from this screen.

 

Thanks in advance

 

 

  • June 01, 2009
  • Like
  • 0

Hi,

I am creating a wizard to create a case with some particular requirements.  After selecting the account, the user selects an existing contact on the account.  If the contact doesn't exist the user should be allowed to create a new contact for that account.  Does anyone know how to: with a button click, send the user to the new contact page with the selected account, return to the calling page and update the contacts in a select list?

 

 

I do have a controller extension for the wizard but don't know how to go about calling a standard page, new contact, and returning.  Mostly I have tried to use the UrlFor function but can't get all the functionality implemented.

 

Thanks for any help.

 

Lloyd

 

  • April 13, 2009
  • Like
  • 0

Hi,

 

      Help!! Help!! Please help me if anyone knows how to update the lookup field within the Object according to associeted Id from another object..

 

trigger updateLookup on Sales_Order__c (after insert, before update) {

// Store all changed sales order object
Map<Id,Id> salesOrder = new Map<Id,Id>();
for(Sales_Order__c s : Trigger.new){
salesOrder.put(s.Id, s.OwnerId);
}

// Create a map of all of the log created according to triggered Sales Order.
Map<Id,Id> createdLog = new Map<Id,Id>();
for(ConnectCompiere_Log__c log : [select Id, Name from ConnectCompiere_Log__c where Id in :salesOrder.values()]) {
createdLog.put(log.Id, log.Name);
}

// Update the sales order lookup field.

for (Sales_Order__c sales: Trigger.new){
sales.Lookup_Log__c = createdLog.get(sales.Id);
}
}

 

I am getting the error like updateLookup: execution of AfterInsert caused by: System.Exception: Record is read-only: Trigger.updateLookup: line 19, column 13

 

This error is in the last  for loop.

 :smileymad:

Please help me.

 

 

Please help me anyone who knows Lookup field update.

 

Is that Lookup field is read-only?

 

Why I can't update the Lookup field with the corresponding Id of the another object?

 

Thanks in advance.

:smileysad: :smileysad:
Message Edited by venkatesh on 02-21-2009 01:44 AM
Message Edited by venkatesh on 02-21-2009 02:56 AM
Message Edited by venkatesh on 02-21-2009 02:57 AM

hi - i am trying to create a new event as follows. the problem i am having is that it is successful according to save result array however no event is created. since there is no error reported, i have no clue what is wrong. any pointer is appreciated. thanks.

        Calendar now = Calendar.getInstance();

        Event e = new Event();

        e.setActivityDateTime(now);

        e.setSubject("Call");

        e.setIsAllDayEvent(false);

        e.setDurationInMinutes(new Integer(5));

     e.setWhoId(c.getId()); // here i have verified that i have a valid contact "c"

     SaveResult[] sr = binding.create(new Event[]{ e }); // here sr.success = true and errors = null

Hi everybody!

 

I need to update the value in the opportunities, plus a value for a particular product that I created, the problem is that I can not change this value after you add a product, someone help me?

 

[google translate it for me :S] 

 

PS: Fields that Cannot Be Updated by Triggers:  Opportunity.amount*

[from documentation :(]

 

thanks in advanced! 

  • February 09, 2009
  • Like
  • 0
Hi All,
           I have created a Apex Detail page for Event. I have button on this Detail page which opens a Second Apex Page, Once I Click the Button on this new Popped Visual force Page, I need the Pop-Up window to be closed and the Parent Visual force window to be refreshed.

Please let me know, if any of us here has a solution for this.

Thanks All,
Sanjay
We have an s-control to override the New button on the Case to pass in some default values from the user record.
It works fine, unless...
 
the user has multiple record types and they do not want to select the default record type.
 
ie. user is presented with the select record type page on clicking New
Selects a record type that is NOT the default one
The default loads anyway
 
The url shows 2 record type ids, first the selected one and then the default one. The default takes precedence.
 
 
The field to be updated and values are on both record types.
 
Any ideas?
  • June 27, 2008
  • Like
  • 0

Hi,

 

Is it possible to send email notification to parent case owner whenever child case close?

 

Thanks

Hi,

 

Is it possible to use case email template without using contact record in singleemailmessage? The problem is sendEmail method of singleemailmessage also send email to contact. which i don't want. Any help!

 

Thanks

Naishadh

Hi,

 

We have multiple categories and each categories points to different customer portal client. We want that user from one categories can not edit ideas of other categories. Is their any way to do so?

 

Thanks

Hi,

 I have two trigger on case both are for before insert and update. Is it possible to assign number to trigger so that it will execute in that order.

(Also if it is in managed package then?)

 Please guide 

Hi,

 

I have found some strange behavior of apex attribute component.  Whenever I load the page it calls component setter method twice. I don't know why. Please suggest.

 

Component

 

<apex:component controller="sampleCon1"> <apex:attribute id="compKey" name="componentKey" description="component key" assignTo="{!componentKey}" type="String"/> </apex:component>

 Page

 

<apex:page > <c:reloadtestcomponent componentKey="CC-006"></c:reloadtestcomponent> </apex:page>

 class

 

 

public with sharing class sampleCon1 { private String componentKey; public String getComponentKey() { System.debug('Inside Component Key : -' + componentKey); return componentKey; } public void setComponentKey(String key) { componentKey = key; System.debug('Inside Set Component Key : -' + componentKey); } public sampleCon1() { System.debug('Inside Contructor'); } }

 

 

 output

15:46:30 DEBUG - ***Begining Page Log for /apex/reloadTestComponentPage 20100118101630.551:Class.sampleCon1.<init>: line 16, column 3: Inside Contructor 20100118101630.551:External entry point: returning from end of method public sampleCon1<Constructor>() in 0 ms 20100118101630.551:Class.sampleCon1.setComponentKey: line 12, column 3: Inside Set Component Key : -CC-006 20100118101630.551:External entry point: returning from end of method public void setComponentKey(String) in 0 ms 20100118101630.551:Class.sampleCon1.setComponentKey: line 12, column 3: Inside Set Component Key : -CC-006 20100118101630.551:External entry point: returning from end of method public void setComponentKey(String) in 0 ms Cumulative profiling information: No profiling information for SOQL operations. No profiling information for SOSL operations. No profiling information for DML operations. 2 most expensive method invocations: Class.sampleCon1: line 10, column 14: public void setComponentKey(String): executed 2 times in 0 ms Class.sampleCon1: line 15, column 9: public sampleCon1<Constructor>(): executed 1 time in 0 ms ***Ending Page Log for /apex/reloadTestComponentPage

 

 

Hi,

 

I am facing some strange behaviour. I have developed before insert trigger on lead.

 

If user edit the record by clicking on edit button link, trigger is executing properly but not in the case of inline editing. 

 

Please guide!

Hi,

 

I have strange question. hope some one  can guide. 

 

One can update the field value using validation field update or through apex trigger/class. If I have already implemented trigger on particular object and require to update any field value on the basis of some condition which one is the better way and why?

Hi,

 

I'm experiencing some unexpected behavior when trying to use the apex:repeat function with apex component.

 

Basically, I want to add component on the basis of data value. My Standalone component is working fine but when I try to put it inside apex:repeat tab rerender stop working.

 

here is my 'simplified' and easily testable page & controller

 

Any assistance greatly appreciated.

 

Component

 

<apex:component controller="customViewController">
<apex:form >
<apex:actionFunction name="changeView" action="{!updateViewList}" reRender="viewList" />
<apex:pageBlock >
<apex:outputpanel id="filterPanel" layout="block" style="background-color:#D9D9D9">
<apex:selectList size="1" multiselect="false" value="{!objectType}" onchange="changeView()">
<apex:selectOptions value="{!ObjectList}"></apex:selectOptions>
</apex:selectList>
<apex:selectList id="viewList" size="1" multiselect="false" value="{!objectView}">
<apex:selectOptions value="{!ObjectViewList}"></apex:selectOptions>
</apex:selectList>
<apex:commandButton value="Go!" action="{!reloadView}" rendered="true" reRender="dataPanel" />
</apex:outputpanel>
</apex:pageBlock>
</apex:form>
</apex:component>

 Component controller

 

public with sharing class customViewController {

public customViewController() {
objectType = 'Opportunity';

objectView = 'My Opportunity';
}

public PageReference reloadView() {
return null;
}


public List<SelectOption> getObjectViewList() {
List<SelectOption> objectViewList = new List<SelectOption>();

if(objectType.equals('Opportunity')) {
objectViewList.add(new Selectoption('My Opportunity','My Opportunity'));
objectViewList.add(new Selectoption('All Opportunity','All Opportunity'));
}

if(objectType.equals('Case')) {
objectViewList.add(new Selectoption('My Case','My Case'));
objectViewList.add(new Selectoption('All Case','All Case'));
}

return objectViewList;
}

public List<SelectOption> getObjectList() {
List<SelectOption> objectList = new List<SelectOption>();

objectList.add(new Selectoption('Opportunity','Opportunity'));
objectList.add(new Selectoption('Case','Case'));

return objectList;
}

public PageReference updateViewList() {
return null;
}

public String objectView {get; set;}

public String objectType { get; set;}
}

 

 VisualForce Page - With Repeat Tab - Component Rerender Not Working

 

<apex:page controller="repeatTestController" >

<apex:repeat value="{!DataList}" var="data">
<c:customviewcomptest></c:customviewcomptest>
</apex:repeat>
</apex:page>

 

 VisualForce Page - Without Repeat Tab - Component Rerender Working

 

<apex:page controller="repeatTestController" >
<c:customviewcomptest></c:customviewcomptest>
</apex:page>

 

 

 

 Controller

 

public with sharing class repeatTestController {
public List<String> getDataList() {
List<String> dataList = new List<String>();

dataList.add('1');

return dataList;

}
}

 

Message Edited by Naishadh on 11-04-2009 03:38 AM

Hi,

 

I have developed some visualforce pages which I want to include in main page. If I pass manual pagename or create getter for each page, apex:include is working fine but for below code, I am getting QuickFixException.

 

Please help!

 

Apex Class code

 

public with sharing class DynamicController {

public List<String> getComponentList() {
List<String> cList = new List<String>();
cList.add('page1');
cList.add('page2');
return cList;
}
}

 Visualforce Page

 

<apex:page controller="DynamicController" >
<apex:repeat value="{!ComponentList}" var="tmp">
<apex:include pageName="{!tmp}"/>
</apex:repeat>
</apex:page>

 

 

 

 

 

Hi,

 

I have developed different component and I want to add it in visual force pages at runtime. Same like one can add component in Google and myyahoo page.

 

I don't find any way of doing this. Please help!

 

 

Hi,

I have overridden my lead page with apex tab panel.  After that, inline editing has stop working.

Please guide.

Hi,

 

I am facing very strange issue. I have very simple event component, fetching event records based on userId.

 

I tested the same query in system log and it displays date in proper format but in component it displays different date format. 

 

Output are highlighted in red font.

 

Please guide. 

 

Test Code in System.log with output

 

for(Event e : [Select e.Subject, e.StartDateTime, e.Id, e.EndDateTime From Event e where e.ownerId = :UserInfo.getUserId() and e.ActivityDateTime = Today]) { System.debug(e.Subject); System.debug(e.StartDateTime.format('h:mm a')); System.debug(e.EndDateTime.format('h:mm a')); }

 Output

 

 

20:07:56 DEBUG - Executing:

for(Event e : [Select e.Subject, e.StartDateTime, e.Id, e.EndDateTime From Event e where e.ownerId = :UserInfo.getUserId() and e.ActivityDateTime = Today]) { System.debug(e.Subject);

 

System.debug(e.StartDateTime.format('h:mm a')); System.debug(e.EndDateTime.format('h:mm a')); } 20:07:56 INFO - 20090908143756.721:AnonymousBlock: line 1, column 1: SelectLoop:LIST:SOBJECT:Event 20090908143756.721:AnonymousBlock: line 1, column 15: SOQL query with 2 rows finished in 19 ms

20090908143756.721:

AnonymousBlock: line 2, column 5: Email

20090908143756.721:AnonymousBlock: line 3, column 5: 7:00 AM

20090908143756.721:AnonymousBlock: line 4, column 5: 8:00 AM

20090908143756.721:AnonymousBlock: line 2, column 5: Call

20090908143756.721:AnonymousBlock: line 3, column 5: 7:00 AM

20090908143756.721:AnonymousBlock: line 4, column 5: 8:00 AM

 

Apex Component 

 

<apex:component controller="EventController"> <apex:repeat value="{!eventList}" var="ev"> <li class="event"> <span> <span class="event"> <apex:outputtext value="{0,date,h:mm a}"> <apex:param value="{!ev.StartDateTime}"/> </apex:outputtext> - <apex:outputtext value="{0,date,h:mm a}"> <apex:param value="{!ev.EndDateTime}"/> </apex:outputtext> </span> <apex:outputlink value="/{!ev.Id}?retURL=/home/home.jsp" target="_blank"> {!ev.Subject} </apex:outputlink> </span> </li> </apex:repeat> </apex:component>

 Controller

 

public with sharing class EventController { public EventController() {} public List<Event> getEventList() { return [Select e.Subject, e.StartDateTime, e.Id, e.EndDateTime From Event e where e.ownerId = :UserInfo.getUserId() and e.ActivityDateTime = Today]; } }

 Output

 

# 2:00 PM -3:00 PM Email
# 2:00 PM -3:00 PM Call

 

 

 

 

 

 

 

 

 

 

 

Hi,

I want to pass data from visual force page to parent page. I am opening VF into popup window.
When I am trying to put data in parent page using javascript window.opener statement, I am getting following error.

Permission denied for <https://c.cs1.visual.force.com> to get property Window.document from <https://cs1.salesforce.com>

Please help!

 
Message Edited by Naishadh on 08-24-2009 01:21 AM
Message Edited by Naishadh on 08-24-2009 01:22 AM
Message Edited by Naishadh on 08-24-2009 01:23 AM

Hi,

 

In my lead object I have two field. email and emailoptout. I want to update all related lead and contact records when I update any lead and contact emailloptout field value. I tried to do so but it goes in infinite loop. Is there any way or through api we can check that record is already udpated or not?

 

Please guide.

Hi,

 

Following query line is generating

 

 

for (Lead l : [select Id, Email, HasOptedOutOfEmail, Spot_Profile__c, SPOT_Communication_Types__c, SPOT_Alternative_Investments__c,SPOT_Banks__c,SPOT_Benefit_Administration__c, SPOT_Brokerage_and_Clearance_Solutions__c,SPOT_Capital_Markets__c,SPOT_Consulting_Services__c, SPOT_Corporations__c,SPOT_Energy__c,SPOT_Enterprise_Solutions__c,SPOT_Institutional_Asset_Management__c, SPOT_Insurance__c,SPOT_Trading__c,SPOT_Wealth_Management__c,SPOT_Workflow_and_Business_Processing__c, SPOT_Global_Trading__c from Lead where isConverted != True and isDeleted != True and Email != null and Email in :profilesMap.keySet() limit :recordLimit for update]) { }

 

 following error.

 

 

System.QueryException: Non-selective query against large object type (more than 100000 rows). Consider an indexed filter or contact salesforce.com about custom indexing. Even if a field is indexed a filter might still not be selective when: 1. The filter value includes null (for instance binding with a list that contains null) 2. Data skew exists whereby the number of matching rows is very large (for instance, filtering for a particular foreign key value that occurs many times)

 

The same code is working fine for the same user in testMethod but shows above error during manual update through browser. Also code is working fine for Administratror profile. Please help!

 

 

Hi, 

 

I want to display some text in bold style. I try to store it in differnt way but salesfoce do not parce that tag and display it as it is. Please help!

 

e.g.

 

Data in Database :-  

Visual Force development for creating <b>new</b> sites.  

 

page Output :- 

Visual Force development for creating <b>new</b> sites.  (It should display new as bold.)

 

please help! 

 

 

 

 

 

Hi,

 

I have portal users working in same account but department is different. Iwant to restrict one department user to see other department user cases. 

 

My account object is bind with accountdetail(department)  object with master-detail relationship. As the number of user are too much I cannot apply role criteria for them. Is there any way I can achieve the same using apex sharing rule?

 

Please guide.

Hi,

I have two visual Force pages and one apex class. Both are the pages method are simplay fetching 10 to 15 records from Salesforce and display it. Please suggest which option is better.

1. Use standard component and extension attribute in <apex:page>

2. Use controller method attribute in <apex:page>.

It may be a silly question but page is taking too much time while loading.  Please help!

Hi,
 
I have two visual Forces page which internally using single controller. Both the page simply fetches the record from 

SalesForce and display it in page Block table format. I have added them in same page layout in two different sections. 

I have tested both the pages individually and performance are excellent but when I add them in single page layout 

in two different section, sometime I get request time out error message or page takes too much time for loading. 


Also, attached the code.

 

<apex:page standardController="SPOT_Profile__c" extensions="SPOTController" showHeader="false" sidebar="false" tabStyle="SPOT_Profile__c"> <apex:form > <apex:inputhidden value="{!spotId}"/> <apex:pageblock > <apex:pageBlockTable value="{!campaignMemList}" var="campObj"> <apex:column headerValue="Lead"> <apex:outputLink value="/{!campObj.LeadId}" target="_blank">{!campObj.Lead.Name}</apex:outputLink> </apex:column> <apex:column headerValue="Contact"> <apex:outputLink value="/{!campObj.ContactId}" target="_blank">{!campObj.Contact.Name}</apex:outputLink> </apex:column> <apex:column headerValue="Campaign Name"> <apex:outputLink value="/{!campObj.CampaignId}" target="_blank">{!campObj.Campaign.Name}</apex:outputLink> </apex:column> <apex:column headerValue="Status"> <apex:outputLabel >{!campObj.Status}</apex:outputLabel> </apex:column> <apex:column headerValue="Member Status Updated"> <apex:outputLabel >{!campObj.LastModifiedDate}</apex:outputLabel> </apex:column> <apex:column headerValue="SunGard Segment"> <apex:outputLabel >{!campObj.Campaign.Segment__c}</apex:outputLabel> </apex:column> </apex:pageBlockTable> </apex:pageblock> </apex:form> </apex:page>

 

<apex:page standardController="SPOT_Profile__c" extensions="SPOTController" showHeader="false" sidebar="false" tabStyle="SPOT_Profile__c"> <apex:form > <apex:inputhidden value="{!spotId}"/> <apex:pageblock > <apex:pageBlockTable value="{!emailResultList}" var="emailObj"> <apex:column headerValue="Lead"> <apex:outputLink value="/{!emailObj.Lead__c}" target="_blank">{!emailObj.Lead__r.Name}</apex:outputLink> </apex:column> <apex:column headerValue="Contact"> <apex:outputLink value="/{!emailObj.Contact__c}" target="_blank">{!emailObj.Contact__r.Name}</apex:outputLink> </apex:column> <apex:column headerValue="Email Name"> <apex:outputLink value="/{!emailObj.Id}" target="_blank">{!emailObj.Name}</apex:outputLink> </apex:column> <apex:column headerValue="Date Opened"> <apex:outputLabel >{!emailObj.Date_Time_Opened__c}</apex:outputLabel> </apex:column> <apex:column headerValue="Date Sent"> <apex:outputLabel >{!emailObj.Date_Time_Sent__c}</apex:outputLabel> </apex:column> <apex:column headerValue="Total Clicks"> <apex:outputLabel >{!emailObj.Number_of_Total_Clicks__c}</apex:outputLabel> </apex:column> <apex:column headerValue="From Address"> <apex:outputLabel >{!emailObj.From_Address__c}</apex:outputLabel> </apex:column> </apex:pageBlockTable> </apex:pageblock> </apex:form> </apex:page>

 

 

public class SPOTController { public String spotId { get; set;} private final ApexPages.StandardController controller; List<xtma_Individual_Email_Result__c> emailResultList; List<CampaignMember> campaignMemList; /*public SPOTController() { }*/ public SPOTController(ApexPages.StandardController controller) { this.controller = controller; } public void loadEmailResults() { spotId = ApexPages.currentPage().getParameters().get('id'); emailResultList = new List<xtma_Individual_Email_Result__c> ([Select x.Name, x.Lead__r.Name, x.Lead__c, x.Id, x.Contact__r.Name, x.Contact__c,x.From_Address__c, x.Number_of_Total_Clicks__c, x.Date_Time_Sent__c, x.Date_Time_Opened__c From xtma_Individual_Email_Result__c x where x.Lead__r.SPOT_Profile__c = :spotId or x.Contact__r.SPOT_Profile__c = :spotId]); } public List<xtma_Individual_Email_Result__c> getEmailResultList() { loadEmailResults(); return emailResultList; } public void loadCampaignData() { spotId = ApexPages.currentPage().getParameters().get('id'); campaignMemList = new List<CampaignMember> ([Select c.Status, c.LeadId,c.Lead.Name, c.Id, c.Campaign.Segment__c, c.LastModifiedDate,c.Contact.Name, c.ContactId, c.Campaign.Name, c.CampaignId From CampaignMember c where c.Lead.SPOT_Profile__c = :spotId or c.Contact.SPOT_Profile__c = :spotId]); } public List<CampaignMember> getCampaignMemList() { loadCampaignData(); return campaignMemList; } }

 

 


Please help! 

 

 

 

Message Edited by Naishadh on 06-15-2009 02:57 AM

Hi,

 

 I have two button on visual force page. One is apex command button and another is outputpanel with styleclass= btn.From apex command button I am calling execute method using action while in outputpanel I am calling execute method using actionFunction.In Execute, code create lead record and redirect to lead defualt list page.

 

It is working fine in case of apex command button but in case of outputpanel, code redirect the page on lead defualt page but it does not change url and also keeping page editor and component in page. Please guide.

 

Please help

 

 

<apex:page controller="VFJavaScriptDemo" >
<apex:form id="actionForm">
<apex:actionFunction id="executeId" name="executeData" action="{!execute}" reRender="dataForm"/>
</apex:form>
<apex:form id="dataForm" >
<apex:inputText id="value" value="{!name}"/>
<apex:commandButton id="Save" value="Submit" action="{!execute}"/>
<apex:outputPanel onclick="checkJavaScript()" styleClass="btn">
Click Me
</apex:outputPanel>
</apex:form>
<script>
function checkJavaScript() {
alert('inside');
executeData();
}

</script>
</apex:page>

 

public class VFJavaScriptDemo {
public String name { get; set;}

public PageReference execute() {
Lead l = new Lead(
lastname = 'VFJavaScript Testing',
company = 'sungard'
);

insert l;

PageReference pg = new PageReference('/00Q/o');
pg.setRedirect(true);

return pg;
}
}

 


 

Message Edited by Naishadh on 05-12-2009 05:43 AM

I have created trigger on my role custom object. If I create, update or delete single record on role it works fine and execute trigger and apex code. But if I try to create/update multiple record using excel connector it simply ignore the trigger.

 

Please guide.

 
 


Message Edited by Naishadh on 11-12-2008 02:31 AM

While parsing an XML file with 10 records, it fails at 6th record. It then enters in catch block  and prints an error statement.

But i want to process the remaining 3 records also.

 

Is there any way to process the remaining records also, plz help.

 

 

 i create a map that contains list of values of different fields

now i want to add the all the values of one field in to a set

how can do this?

 

help me please...........

  • January 05, 2011
  • Like
  • 0

Hi

 

I am retrieving data by consuming a webservice and displaying it in the visual force page using the page block table. I need to sort the records based on the date. Can anyone guide me to achieve this requirement.

 

Thanks in advance

i want to get the data from child object

how can  i query the data

 

 

Thanks in advance.........

 

 

 

 

 

  • January 05, 2011
  • Like
  • 0

The following code in other people's development environment is right,but   in my development environment is wrong.Why?

 

  public List<SelectOption> getItems() {
          List<SelectOption> options = new List<SelectOption>();
          options.add(new SelectOption('US','US'));
          options.add(new SelectOption('CANADA','Canada'));
          options.add(new SelectOption('MEXICO','Mexico'));
          return options;
   }

 error:Constructor not defined: [selectOption].<Constructor>(String, String)

 

  

in addition:

  PageReference acctPage = new ApexPages.StandardController(account).view();

error:Illegal assignment from System.PageReference to pageReference

 

what is the difference between  System.PageReference  and pageReference?

 

I have a Hierarchy Custom setting with one field IsProcessed.

 

My batch apex will run only when the value of  IsProcessed is true. After processing I need to update the value to false. I doubt whether it is possible.

 

Is there a way I can update a custom setting field value using apex.

 

Appreciate your help.

Hi,

 

I am new to creating webservices using Apex

I've read and re-read the Iterable section in the Apex reference manual but I just don't get it.  How do you specify the SOQL query to select the records for processing?  Or do you just pass a List of objects into Database.executeBatch(), and does that List become the scope in the example on page 253?

And finally - if Iterable is subject to the standard governor limit on SOQL retrieved records, why would you use it?  I can't see the benefit of using it vs. a standard Apex class if the limits are the same.

Thanks
David

 

I have a nightly batch process which is going to do some updates to the Event objects. The job is scheduled to run from a System Administrator User who has MODFIY ALL for the profile.

 

I see this error popup once in a while when someone has marked an event as private.

 

First error: Update failed. First exception on row 31 with id XXXXXXXXXXXX ; first error: FIELD_INTEGRITY_EXCEPTION, Private events/meetings for other users are not allowed: Private: [IsPrivate]

 

Does anyone know how to get around this issue other than ignoring those records with isPrivate == true.

How to implement timer in VF pages?

 

I want the page to be submitted when timer is set?

 

 

Kindly help me.

I am trying to develop an online exam.

 

I was successful in keeping all the questions and writing class for them.

It works fine, but I need some questions which should be randomly picked from object.

Every time these questions should be different.

How can we achieve randomly ques from db?

 

Help me out at earliest.

I want to generate a 8-character auto password in my standard object, when i will save my record.

Please help me to find out the solution of this.

Thanks in advance!

Hi

i just meet one question, when i convert the string to integer type. i used the integer.valueof() method . but if string like 'ABCDEF' that can't  do integer conversion but throw System.TypeException.

could i do judgement first first? like if the string parameter s='123'  can do integer conversion, and then i call the integer.valueof(s)

is there any method ??

 

 

 

Hi All,

 

I want to send an email with an Attachment from Notes and Attachment related list.

 

i.e. i have few attachments inside Notes and Attachment related list of a custom Object.. and on a button click i need to send an email with attachment

 

please let me kow how can i do that...

 

 

Thanks

Hi,

 

We have built a new tab as "partner" which is very similar to standard tab Account.

 

What we need to do:

In Account tab, when new Account button is created,

  • we need to see what is role of logged in user
  • if logged in user role is Channel Sales manager, redirect to new partner page
  • if logged in user role is NOT Channel Sales manager, continue as expected and show create new account page.

I have overridden new Account button and am calling an apex page on it. On the extension of this apex page, I have written out the logic to get the logged in user role. I am able to get the role of logged in user.

 

This is well printed on Systems debug.

 

But, I do not know how to redirect to partner apex page (is case it is CSM) or continue to new standard Account page (in case non CSM) from an apex class.

 

Please help me on this one.

 

 

Thanks,

Anuj, the 'Newbie'

I have a requirement where in  I need to fetch the records from Opportunity standard object based on the closedate field (MM/DD/YYYY) criteria.  For that I have written a visualforce page which takes the close date in the search field which is accepted as a string.  But in the Apex class when I am executing the sql query, i am getting type mismatch error, date cannot be compated to string.   I tried many options to convert string to date, but its not working.   I am  postng  the code snippet.

 

 

Apex Class

 

 

public class OpportunitySearchController1 {

    public OpportunitySearchController1() {

    }

    
    private ApexPages.StandardController controller {get; set;}
  
      public List<opportunity> searchResults {get;set;}
    
          public string searchText {
        get {
            if (searchText == null) searchText = 'Test'; // prefill the serach box for ease of use
            return searchText;
        }
        set;
    }
  
    
 
    public OpportunitySearchController1(ApexPages.StandardController controller) {
 
               this.controller = controller;
       
    }
 
   
    public PageReference search() {
        if (searchResults == null) {
            searchResults = new List<opportunity>(); // init the list if it is null
        } else {
            searchResults.clear(); // clear out the current results if they exist
        }
        // Note: you could have achieved the same results as above by just using:
        // searchResults = new List<categoryWrapper>();
        String date_search= searchText;
 
        // use some dynamic soql to find the related opportunities by name
       
           String qry = 'Select o.Id, o.Name, o.StageName, o.CloseDate, o.Amount from Opportunity o  where  o.closedate LIKE \''+searchText+'%\' Order By o.Name';
      
        searchResults = Database.query(qry);
        return null;
    }
 }

 

 

VisualForce Page

-------------------------

<apex:page standardController="Opportunity" extensions="OpportunitySearchController1" sidebar="true" showHeader="true" >
<style type="text/css">
body {background: #F3F3EC; padding-top: 15px}
</style>
<!-- <b><apex:outputLink value="https://c.ap1.visual.force.com/apex/jeff"> Opportunities </apex:outputLink></b>&nbsp;&nbsp;
<b><apex:outputLink value="https://c.ap1.visual.force.com/apex/subhash"> Contacts </apex:outputLink></b>
-->
<apex:form >
<br/><br/><br/>
<b><apex:outputLink value="https://c.ap1.visual.force.com/apex/GeneralReport"> Opportunities </apex:outputLink></b>&nbsp;&nbsp;
<br/><br/> <b><apex:outputLink value="https://c.ap1.visual.force.com/apex/DisplayReport"> Tasks </apex:outputLink></b>
<br/><br/>
<apex:pageBlock title="Search for Opportunities by Keyword" id="block" mode="edit">
<apex:pageMessages />

<apex:pageBlockSection >
<apex:pageBlockSectionItem >
<apex:outputLabel for="searchText">Close Date</apex:outputLabel>
<apex:panelGroup >
<apex:inputText id="searchText" value="{!searchText}"/>
<apex:commandButton value="GO" action="{!search}" rerender="resultsBlock" status="status"/>
</apex:panelGroup>
</apex:pageBlockSectionItem>
</apex:pageBlockSection>
<apex:actionStatus id="status" startText="Searching... please wait..."/>
<apex:pageBlockSection id="resultsBlock" columns="1">
<apex:pageBlockTable value="{!searchResults}" var="o" rendered="{!NOT(ISNULL(searchResults))}">
<apex:column headerValue="Name">
<apex:outputLink value="/{!o.Id}">{!o.Name}</apex:outputLink>
</apex:column>
<apex:column value="{!o.StageName}"/>
<apex:column value="{!o.Amount}"/>
<apex:column value="{!o.CloseDate}"/>

</apex:pageBlockTable>
</apex:pageBlockSection>

</apex:pageBlock>
</apex:form>
</apex:page>

 

If you have any  solution for the above mentioned code kindly post your suggestion. 

 

 

 

 

Regards

 

Arun

 

Hi,

 

Does anybody have an example of how to do that? I mean, the problem is that it seems "Oracle SOA Suite" doesn't allow to process the WSDL of external webservices by its file, only by giving a valid URL address where the webservice is located.

 

For example: www.mycompany.com/service.asp?wsdl   or  www.mycompany.com/service/process.wsdl

 

The problem with Salesforce is that the generated WSDLis not public from an URL address.

 

Please, help in this case.

 

Regards,

 

 

Wilmer

  • January 26, 2010
  • Like
  • 0