• nickwick76
  • NEWBIE
  • 475 Points
  • Member since 2010
  • Senior Consultant and Technical Lead
  • Softhouse Consulting


  • Chatter
    Feed
  • 16
    Best Answers
  • 2
    Likes Received
  • 0
    Likes Given
  • 22
    Questions
  • 107
    Replies
I have created a page for dynamic search using Using jeffdouglas blog wit hsome modifications. Its not working form me. Am i wrong Anywhere?

CLASS:

public with sharing class vki2{

 private String soql {get;set;}
 
  public List<Contact> contacts {get;set;}

 
  public String sortDir {
    get  { if (sortDir == null) {  sortDir = 'desc'; } return sortDir;  }
    set;
  }

 
  public String sortField {
    get  { if (sortField == null) {sortField = 'Name'; } return sortField;  }
    set;
  }

 
  public String debugSoql {
    get { return soql + ' order by ' + sortField + ' ' + sortDir; }
    set;
  }

 
  public vki2() {
    soql = 'select Name, Leadsource from contact';
    runQuery();
  }

 
  public void toggleSort() {
    
    sortDir = sortDir.equals('asc') ? 'desc' : 'asc';
   
    runQuery();
  }

 
  public void runQuery() {

    try {
      contacts = Database.query(soql + ' order by ' + sortField + ' ' + sortDir);
    } catch (Exception e) {
      ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.ERROR, 'Oops!'));
    }

  }

    public PageReference runSearch() {

    String Name= Apexpages.currentPage().getParameters().get('Name');
     String Leadsource= Apexpages.currentPage().getParameters().get('Leadsource');
    
    soql = 'select Name,Leadsource from contact';
    
    if (!Name.equals(''))
      soql +=  ' and Name LIKE \''+String.escapeSingleQuotes(Name)+'%\'';
       if (!Leadsource.equals(''))
      soql += ' and Leadsource LIKE \''+String.escapeSingleQuotes(Leadsource)+'%\'';
  
    runQuery();

    return null;
  }

 
  public List<String> Leadsource{
    get {
      if (Leadsource== null) {

        Leadsource= new List<String>();
        Schema.DescribeFieldResult field = Contact.Leadsource.getDescribe();

        for (Schema.PicklistEntry f : field.getPicklistValues())
          Leadsource.add(f.getLabel());

      }
      return Leadsource;          
    }
    set;
  }

}


VF:

<apex:page controller="vki2" sidebar="false">
  <apex:form >
  <apex:pageMessages id="errors" />
  <apex:pageBlock title="Find!" mode="edit">
  <table width="100%" border="0">
  <tr>  
    <td width="200" valign="top">
      <apex:pageBlock title="Parameters" mode="edit" id="criteria">
      <script type="text/javascript">
      function doSearch() {
        searchServer(
          document.getElementById("Name").value,
         
          document.getElementById("Leadsource").options[document.getElementById("Leadsource").selectedIndex].value
          );
      }
      </script>
      <apex:actionFunction name="searchServer" action="{!runSearch}" rerender="results,debug,errors">
          <apex:param name="Name" value="" />
          <apex:param name="Leadsource" value="" />
      </apex:actionFunction>
      <table cellpadding="2" cellspacing="2">
      <tr>
        <td style="font-weight:bold;">Name<br/>
        <input type="text" id="Name" onkeyup="doSearch();"/>
        </td>
      </tr>
      <tr>
        <td style="font-weight:bold;">Leadsource<br/>
          <select id="leadsource" onchange="doSearch();">
            <option value=""></option>
            <apex:repeat value="{!Leadsource}" var="category">
              <option value="{!category}">{!category}</option>
            </apex:repeat>
          </select>
        </td>
      </tr>
      </table>
      </apex:pageBlock>
    </td>
    <td valign="top">
    <apex:pageBlock mode="edit" id="results">
        <apex:pageBlockTable value="{!contacts}" var="o">
            <apex:column >
                <apex:facet name="header">
                    <apex:commandLink value="Name" action="{!toggleSort}" rerender="results,debug">
                        <apex:param name="sortField" value="Name" assignTo="{!sortField}"/>
                    </apex:commandLink>
                </apex:facet>
                <apex:outputField value="{!o.Name}"/>
            </apex:column>
            <apex:column >
                <apex:facet name="header">
                    <apex:commandLink value="Leadsource" action="{!toggleSort}" rerender="results,debug">
                        <apex:param name="sortField" value="Leadsource" assignTo="{!sortField}"/>
                    </apex:commandLink>
                </apex:facet>
                <apex:outputField value="{!o.Leadsource}"/>
            </apex:column>
        </apex:pageBlockTable>
    </apex:pageBlock>
    </td>
  </tr>
  </table>
  </apex:pageBlock>
  </apex:form>
</apex:page>

Thank U
 

Can any one please point out what I am doing wrong , I need the id of Case_Accession__c  on click of edit in data table in text box but not getting

 

public class Worklist
{
   

    public List<Case_Accession__c> objWorklist {get;set;}
     public String var {get;set;}


    public Worklist()
    {
        objWorkList = new List<Case_Accession__c>();
        objWorkList = [Select ID,PatientName__c,PhysicianName__c  from Case_Accession__c limit 1];
    }

 

}
 }

 

 

VF Page::

 

<apex:page controller="Worklist">
     <apex:Form >
     <apex:pageBlock >
             <apex:pageblockSection >
                 <apex:dataTable id="dtWorklist" value="{!objWorklist }" var="wrklst"  cellspacing="16%">
                  <apex:column headerValue="Patient Name" >
                   <apex:outputField value="{!wrklst.PatientName__c}" />
                   </apex:column>
                   <apex:column headerValue="Physician Name" >
                   <apex:outputField value="{!wrklst.PhysicianName__c}" />
                   </apex:column>
                
                   <apex:column headerValue="Edit Case">
                   
                   <apex:commandLink value="Edit" /> 
                   <apex:param name="var" assignTo="{!var}" value="{!wrklst.id}" />  
                    </apex:column>
                  
                 </apex:dataTable>
                 <apex:inputText value="{!var}"/>
                </apex:pageblockSection>
     </apex:pageBlock>
     </apex:Form>
</apex:page>
   

When talking to another developer today we came across a question that we can't find the answer to so I was hoping someone here knew the answer.  I know that you can create a visualforce page with more than one extension.  My questions are:

1. Why would you use more than one?

2. If you have more that one in what order does visualforce look for your method?

3. What happens if you have a method with the same name on different extensions?

  • September 06, 2013
  • Like
  • 2

I'd like to share some data across 2 visualforce pages,  so I developed 2 pages that share a single controller:

PageOne

<apex:page controller="PageOne">
    <apex:form >
        <apex:inputText value="{!ThingOne}"/>
        <apex:commandButton value="Next" action="{!Next}"/>
    </apex:form>
</apex:page>

 and PageTwo 

<apex:page controller="PageOne">
    <apex:form >
        <apex:inputText value="{!ThingOne}"/>
        <apex:commandButton value="Previous" action="{!Previous}"/>
    </apex:form>
</apex:page>

 share

public with sharing class PageOne {

    public PageReference Previous() {
        return new PageReference('/apex/PageOne');
    }

    public PageReference Next() {
        return new PageReference('/apex/PageTwo');
    }

    public String ThingOne { get; set; }
}

 Which works fine and I'm happy.

 

However,  supposing Page One had a great deal of complexity and Page Two had a very simple visual output that was based on a result of this complexity.  I'd like to remove the complexity from the work to be done by Page Two,  so,  it seemed to me that the best way to do this would be to continue to share the custom controller and to use an extension on each page.  The code now reads:

PageOne:

<apex:page controller="PageOne" extensions="PageOneExt">
    <apex:form >
        <apex:inputText value="{!ThingOne}"/>
        <apex:commandButton value="Next" action="{!Next}"/>
    </apex:form>
</apex:page>
public with sharing class PageOneExt {
    public PageOne pageController;

    public PageOneExt(PageOne controller) {
        pageController = controller;
        system.debug('***pageController: ' + pageController);
    }

}

 

PageTwo:

<apex:page controller="PageOne" extensions="PageTwoExt">
    <apex:form >
        <apex:inputText value="{!ThingOne}"/>
        <apex:commandButton value="Previous" action="{!Previous}"/>
    </apex:form>
</apex:page>

 

public with sharing class PageTwoExt {
    public PageOne pageController;
    
    public PageTwoExt(PageOne controller) {
        pageController = controller;
/*
* Do a work here with data from Page One
*/ system.debug('***pageController: ' + pageController); } }

 However,  the ThingOne string is no longer shared between the pages and I don't understand why.  Am I doing something wrong or missing the point somewhere?

 

  • September 06, 2013
  • Like
  • 0

public Object__c incSearch = new Object__c ();

 

Result  = filed__c from Object__c where Status__c =: incSearch.Status__c OR Incident__c like :incSearch.Incident_No_for_Search__c+'%' OR Applies_To__c=:incSearch.Applies_To__c OR Responsible__c = :incSearch.Responsible__c];

 

Please explain the above code and what is use of '%' here ??

 

Thanksin advance!!

i really like using the developer console to write code, but how can i quickly run tests from here and get the results?

what im doing now is have console on one monitor and setup / develop / classes on the other

after i save in the console, i go to setup, go to the class and hit the run tests button

is there an easier way?

Hi. I'd like to pass parameter information into a apex:insert element. I've mocked up sort of what I'd like to do - which is to create a apex:parameter (something that in reality doesn't exist) and to populate that parameter from the actual page using a apex:property element (which doesn't exist in reality).  What I'd like to do is avoid creating mock_portlet1, mock_portlet2 etc. Thanks.

Template:
<apex:page controller="mockPortletController">
 <apex:messages />
<table><tr><td>
   <apex:insert name="mock_portlet" >
    <apex:param key="columnNo" />
   <apex:insert>
</td><td>
    <apex:insert name="mock_portlet" >
    <apex:param key="columnNo" />
   <apex:insert>
</td></tr></table>
<apex:page>

 

Page:
<apex:page controller="selectAllPortletDataController">
    <apex:composition template="myFormComposition">
    <apex:define name="mock_portlet">
        <apex:property key="columnNo" value="1"/>
    </apex:define>
    <apex:define name="mock_portlet">
        <apex:property key="columnNo" value="2"/>
    </apex:define>
   
    </apex:composition>
</apex:page>

 

How to convert a look up field to master-detail field type?

There are some records in the object. I am getting this error msg:

populate the lookup field with data in all records and then change the relationship type to Master-Detail.

 

 

How to populate the lookup field with data in all records?

 

 

Hi folks,

 

Just a quick query...

 

Is there a list of standard field names for using in Apex anywhere? I guessed that the person to whom a "Task" is assigned is "WhoID", but I'm sick of making these guesses. Is there a comprehensive list anywhere?

 

Thanks,

Lee

Hi everyone.....

i am new to the apex Test class..so plz help me on for writing the test class for below code

 

trigger autonumber1 on Account (before insert)
{
  for(account a:trigger.new)
  {
  
    List<account> ac=[select autonumber__c from account];
 if(ac[0].autonumber__c!=null)
  {
  a.autonumber__c=ac[0].autonumber__c+1;    
   }
   else
   a.autonumber__c=1200;
}
}

 

i am getting 60% code coverage but i got the failure message like...

System.DmlException: Insert failed. First exception on row 0; first error: CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY, autonumber1: execution of BeforeInsert caused by: System.ListException: List index out of bounds: 0 Trigger.autonumber1: line 7, column 1: []

 

 

thanks in advance...

 

 

 

 

Unable to render...Here is th code

 

  

<apex:pageblocksectionItem >
<apex:outputpanel >
<apex:inputCheckbox value="{!Invoice.Partial_Payments__c}"/>
<Apex:outputLabel value="Allow for Partial Payments(Installments)"></Apex:outputLabel>
</apex:outputpanel>
<apex:actionSupport event="onclick" rerender="Select"/>
</apex:pageblocksectionItem>


<apex:outputpanel id="Select">
<apex:outputpanel rendered="{!Invoice.Partial_Payments__c==true}">
<apex:pageblockSectionItem >
<Apex:outputlabel value="aaaaaaaaa"></Apex:outputlabel>
</apex:pageblockSectionItem>
</apex:outputpanel>
</apex:outputpanel>

 

Thanks,

I have a sample data and based on that I want to create a simple heat map that has color representation.How can I do that?

I am very new to apex.  I would like to be able to assign a variable the id from a salesforce object.  For instance I have a apex code that creates a contact.  I would like to tie that contact to the account.  So I want to do a lookup for the account salesforce object that meets a few criteria, like account name = contact name. 

Hi,
I have an external source and a couple of external objects defined and synched.
For one of the objects I have created an indirect lookup to the Account and a specified field which matches the external record with the account record. On the account page layout there is a related list with the external objects related to this account via this indirect lookup.

Now this related list seems to have a limit of 100 records.
It is possible to query the external objects via SOQL from the developer console for example and although the external records are way more than hundred there always seems to be a limit of 100 for how much that is allowed to display via the related list. 

Anyone know if this is a limit we have to live with or if there is anyway to adjust it?. For us this is very important and not really usuable else.

Thanks / Niklas
I am exporting data from one Salesforce org to another. I have come to tasks and for some reason I got stuck och mass emails. That is tasks that in the SF-GUI are present in the activity history of an object like contact or account for example. When I create a query via a data loader the tasks are not in scope. When I use the workbench and create a SOQL-query I cannot see these tasks. I know they are there but they don't show in any results.
For example use this SOQL-query in the workbench
select id,subject from Task where Subject like 'Mass%'
It gives me zero result.

A similar query gives me result as expected.
select id,subject from Task where Subject like 'Email%'

Now, why is that?

Thanks / Niklas
Hi,
Mobile push registration records are created when a user accesses Salesforce for example via the Salesforce1 app. Find them from the user record. As you press the allow button, when accessing via the app, a record gets created with a created date. Then you close the app and when you open it tomorrow the same session is used again allowing for login without any specific allowance needed or having to give your username and password again. And the second time the last registration date has changed but not the created date.

My question is if these mobile push registration records are removed from time to time if there has been too long since the last login for example. We had a user who quit his employment, but the user record was important so the user wasn't made inactive. Instead we changed the password and email address. However we noticed that the user was still accessing Salesforce through the app due to the session that keeps working. I looked at the logs and saw that the created date was more than two weeks after we changed the password but it was also the first attempt after he quit. A mobile push registration record was created at this time. 

Now, what does this mean? Was his session still working from long before or how did he access Salesforce via the app? Shouldn't there already be a mobile push registration record? Since I can only get these records created myself by actively allowing the app to access salesforce and when using my username and password I am confused and want to know how this works. See the record I am talking about below. Created date here is 2015-01-07, but the password was changed in 2014-12-19.

mobile push registration record

Thanks / Niklas
Hi,
I was playing around with Lightning components and created an input field which on the onchange event through the client contoller and helper calls the server controller to get a list of accounts which are returned to the helper via the callback function and then set to an attribute in the component page. I am printing these in the controller using the aura:iteration tag. For each of the accounts I am displaying I want to link them to open the account page layout in Salesforce1.

Is there an aura ui component for this? I solved it by using the below syntax, but it doesn't seem right. And although it works I don't get a back arrow to go back to the list which you can see if you are looking at an account record that you have navigated to from the 'All Accounts' list for example,
<aura:iteration items="{!v.accs}" var="a">
    <a href="{!'/one/one.app#/sObject/' + a.Id + '/view?t=1414009941155'}">{!a.Name}</a>
</aura:iteration>
Currently I am using this aura reference (https://eu3.lightning.force.com/auradocs/reference.app#) but it is not very extensive.
So is this coming later or am I missing something that I should be aware of?

Thanks / Niklas
 
Hi,
I am calling a webservice on an external system. At first, the webservice took one address as input, did some work in the external system and then returned some data. I need to do this for many addresses in one transaction.

Using the current webservice I cannot do more than 10 callouts however due to the governor limits.
So then after messing around with Batch Apex and future methods (several transactions but in which I run into other issues with other limits and User interaction problems) I figured the best way would be to change the webservice so that it takes a list of addresses instead.

No I can see that there is another limit. The three paragraphs below is directly taken from the apex documentation on salesforce.

- A single Apex transaction can make a maximum of 10 callouts to an HTTP request or an API call.
- The default timeout is 10 seconds. A custom timeout can be defined for each callout. The minimum is 1 millisecond and the maximum is 120,000 milliseconds. See the examples in the next section for how to set custom timeouts for Web services or HTTP callouts.
- The maximum cumulative timeout for callouts by a single Apex transaction is 120 seconds. This time is additive across all callouts invoked by the Apex transaction.

Since I have a problem testing this, can anyone verify if number three above (in bold) means that even if I now make several calls with a list of addresses in each (to avoid timeout for a single call which is for number 2 above), my operation will still fail if the external system all together for all addresses need more than 120 seconds to deliver back the responses to me?

If this is the case I have no idea how to handle this other than to continue with the future method approach which gives me a limit of 10*10 addresses instead and problem rerendering the page for the user since the future calls that I create will have no connection with the page at all since these jobs are asynchronous. I am working with PushTopic as a possible solution and hope that will help me some.

But please first if someone can confirm and translate the above for me about cumulative timeout.


Thanks / Niklas
Hi,
I am calling a webservice on an external system. At first, the webservice took one address as input, did some work in the external system and then returned some data. I need to do this for many addresses in one transaction.

Using the current webservice I cannot do more than 10 callouts however due to the governor limits. 
So then after messing around with Batch Apex and future methods (several transactions but in which I run into other issues with other limits and User interaction problems) I figured the best way would be to change the webservice so that it takes a list of addresses instead.

No I can see that there is another limit. The three paragraphs below is directly taken from the apex documentation on salesforce.

- A single Apex transaction can make a maximum of 10 callouts to an HTTP request or an API call.
- The default timeout is 10 seconds. A custom timeout can be defined for each callout. The minimum is 1 millisecond and the maximum is 120,000 milliseconds. See the examples in the next section for how to set custom timeouts for Web services or HTTP callouts.
- The maximum cumulative timeout for callouts by a single Apex transaction is 120 seconds. This time is additive across all callouts invoked by the Apex transaction.

Since I have a problem testing this, can anyone verify if number three above (in bold) means that even if I now make several calls with a list of addresses in each (to avoid timeout for a single call which is for number 2 above), my operation will still fail if the external system all together for all addresses need more than 120 seconds to deliver back the responses to me?

If this is the case I have no idea how to handle this other than to continue with the future method approach which gives me a limit of 10*10 addresses instead and problem rerendering the page for the user since the future calls that I create will have no connection with the page at all since these jobs are asynchronous. I am working with PushTopic as a possible solution and hope that will help me some. 

But please first if someone can confirm and translate the above for me about cumulative timeout.

Thanks / Niklas

Hi,

I am creating PDF's for a customer. These are generated from VF-pages using renderas="pdf".

I recently discovered that any font cannot be used here. In fact we have around 10 to choose from (see http://help.salesforce.com/apex/HTViewSolution?id=000113353&language=en_US).

Now this customer really need to have this font on these pdf's since its a graphical bureau and important for them.

 

Does anyone know if there is a workaround some way ta use other fonts or should I simply say that it's not possible?

 

Thanks / Niklas

Hi,

My goal is to call a controller from a visualforce component using Javascript remoting and then to update the visualforce chart with the result.

 

The javascript remoting call works fine and I can see in the debug console that it receives the correct values as well. But how do I update the chart with this data?

 

Here's the javascript code. testCharts is my controller and getRemoteData is the RemoteAction method.

 

<script type="text/javascript">
function getOppChart() {
var year = '2013';

Visualforce.remoting.Manager.invokeAction(
'{!$RemoteAction.testCharts.getRemoteData}',
year,
function(result, event) {
if (event.status) {
	// Actions here, update VF chart?
} else if (event.type === 'exception') {
	document.getElementById("responseErrors").innerHTML = event.message;
} else {
	document.getElementById("responseErrors").innerHTML = event.message;
}
}, 
{escape: true}
);
}
</script>

The visualforce chart component. The data attribute is required. How do I pass the result from the javascript function here? I would like to make this dynamic so that when I select a value in a picklist on the page a new call is made and the chart is refreshed. But as a start I'd just like to know how to get the result there. If I was just using a controller I would just put the method name in the data attribute, i.e. data="{!oppData}".

 

<apex:chart height="300" width="600" data="???">
	<apex:axis type="Numeric" position="left" fields="data,data2" 
	title="Total Order value" grid="true"/>
	<apex:axis type="Category" position="bottom" fields="name" 
	title="Month of the Year">
	</apex:axis>
	<apex:lineSeries axis="left" fill="true" xField="name" yField="data2"
	markerType="cross" markerSize="4" markerFill="#FF0000"/>
</apex:chart>

 The reason I am not using the Apex controller methods directly is because of three reasons.

- I hope the user will find this more reponsive

- I want to be able to rerender the charts

- I just want to make it work!!!

 

Can't find anything on the boards or google. Anyone got ideas?? Much appreciated!

 

Thanks / Niklas

 

I need to do two print actions.

 

1. Print X records as pdfs. These should look the same way but with different data. This should be able to solve by printing a visualforce page rendered as pdf which loops over the records I am interested in.

 

2. Print attachments to a record. For example a pdf-file attached to a contact. I would like to print this X times. Anyone know how this can be accomplished? I seek all possible ways. One way is probably to have it opened from the code and then click the print button yourself from the PDF-application. It would be preferred to have it sent to the printer automatically and just confirm or perhaps some other smart solution.

 

Thanks / Niklas

Hi,

I have a customer portal and a site.

Authenticated WebSite users log in and needs to click a link and get an attachment opened.

I have copied the attachment and put it on a custom object så the attachment has the authenticated website user as owner. Now, since this portal user has read access to attachments it should be possible to display this attachment, but how? Which URL should I use? The minute I step out of the portal I get insufficient access.

If I try to use the link myself (admin) it works of course. This URL are of this type: https://c.cs7.content.force.com/servlet/servlet.FileDownload?file=123761873682173

 

But, what's the appoach to open and display attachments to portal users?

 

Thanks!

 

// Niklas

We have ímplemented On-Demand Email-To-Case for a customer.

The customer recently got 6 emails that had this error message in the body.

 

"The following error occurred at the request of the incoming e-mail:

LIMIT_EXCEEDED : A loop was detected in Email-to-Case processing".

 

It was sent from support@emea.salesforce.com to a system admin with the subject 'Email-to-Case: Failures occurred during processing'

 

However reading about Email Loops, we don't seem to have encountered the same problem with thousands of cases being created due to autoresponse rules at both sender and receiver.

 

I don't think that the example in the e-mail has been registered as a case and email message either since the timestamps don't match exactly. However this is confusing. The email messages that I look at have a message date different from created date altough it says in the object reference documentation that the message date is the date the email was created. How does this work? (sub question)

 

Due to the lack of newly created cases that usually is a symptom on email loops I don't understand the error message and what has really happened. Anyone got a clue here?

 

Thanks / Niklas

I have created a Visualforce page with a pageblock table and a couple of columns. The first column contains a apex:commandlink element. 
I put this VF-page as an inline VF-element in a page layout. Clicking the link will open the page in the iframe. It doesn't matter what I put in the 'target' attribute (_top, _blank etc.).
If I create a HTML link above the table in the same VF-page the target attribute works, i.e. the new page opens in the whole window or a new window. 

So this code works:
<a href="http://www.salesforce.com" target="_top">test</a>

 

But this does not:
<apex:form >
<apex:outputPanel id="mainOppNotes">
<apex:pageBlock title="Notes" mode="maindetail">
<apex:pageBlockTable value="{!MainOppNotes}" var="n">
<apex:column headerValue="Action" width="5%">
<apex:commandLink action="{!viewNote}" id="viewNote" rerender="mainOppNotes" value="View" styleClass="actionLink" target="_blank">
<apex:param name="noteId" assignTo="{!noteId}" value="{!n.Id}" />
</apex:commandLink>
</apex:column>
<apex:column headerValue="Name" width="65%">{!n.Title}</apex:column> 
<apex:column headerValue="Last Modified" width="30%"><apex:outputtext value="{!n.LastModifiedByName}" />,&nbsp;<apex:outputtext value="{!n.LastModifiedDateStr}" /></apex:column>
</apex:pageBlockTable>
</apex:pageBlock> 
</apex:outputPanel>
</apex:form >
 
Can I affect this in any way? Why does it work like this?
// Niklas

Hi,
I need to create a CA certificate to be used by an external system that communicates a lot with salesforce over the API (web services). I have created a type 'CA-signed' certificate and downloaded it and now need it to be signed by a certificate authority before uploading it. My guess now is that it needs to be signed by for example Verisign. Could you please help me on the way here. Which signer do I choose? I am looking at this page (http://wiki.developerforce.com/index.php/Outbound_Messaging_SSL_CA_Certificates) and how do I proceed from here?

Thanks!

Hi

I am trying to deploy profiles from sandbox to production. This is not possible because of the error message:

 

 

AProfileName : In field: recordType - no RecordType named idea.Record_type_for_community_091T00000004HfhIAE_entity_Idea found

 

 

I came to the conclusion that this is probably because the sandbox has a test community created (can be found in Customize -> Ideas - Communities). There is one default there named 'Internal Ideas' but in the sandbox there is an additional one.

 

I tried to de-activate the community. Then I removed the sandbox project from Eclipse and then imported it again (under a different name). Still the same error. Furthermore it is not possible to delete communities.

 

Now, what do I do? 

 

The idea has struck me to create a community manually in PROD but I don't think that it will have the same Id as the one in the error message above anyway.

 

Any help appreciated!

 

BR / Niklas

Hi, 

For several profiles in our org we have selected 'Modify All' for some objects. The reason for this is that these persons need to be able to change for example the Account Owner on Accounts that they do not own themselves. These users might be sales managers for example.

 

This has worked fine before, but now we have a problem since we are going to migrate data into Salesforce for a new set of sales reps and sales managers. The new users and the old users are not allowed to see each others data.

With 'Modify All' chosen for for example the sales manager's profile he can see the new users data. 

 

Is there a way to get around this?

 

1. We still want to keep the possibility of some users being able to change the sharing on some objects that they don't own themselves.

 

2. The data created by the two groups (old and new users) must be absolutely separated. I.e. they are not allowed to read or edit each others data.

 

Thanks for any help even if it means it's not possible!

 

BR / Niklas

Hi,

When the SOQL-query in the code below returns more than 100 records I get following error message:

 

System.LimitException: Too many DML rows: 184

 

public void rollupAccountLocationUpdate(List accountLocations) {
// Rollup updates to account locations to the opportunity line item "Last Modified Date" field    
        List<OpportunityLineItem> opportunityLineItemsToUpdate = new List<OpportunityLineItem>();
        for (OpportunityLineItem opportunityLineItem : [Select Id From OpportunityLineItem Where Account_Location__c In : accountLocations]) {
    	    opportunityLineItem.Last_Modified_Date__c = system.now();
    	    opportunityLineItemsToUpdate.add(opportunityLineItem);
        }
        Database.SaveResult[] results = Database.update(opportunityLineItemsToUpdate, false);
}

 

As I understand it, the update command should be able to take 1000 records.

This class is called by a trigger. Could that be the reason?

 

Ideas and suggestions are welcome!

 

BR / Niklas

 

Hi all,

A supplier to us is calling the WebToLead servlet and gets the following response:

 

HTTP/1.1 200 OK Server:  Cache-Control: private Is-Processed: true Exception:system.organization.exception.InvalidOrganizationIDException Content-Type: text/html; charset=UTF-8 Content-Length: 0 Date: Thu, 09 Sep 2010 08:01:41 GMT

 Do anyone know what is wrong? What does this exception mean? It has worked in the future. To me it sounds like the Salesforce Org Id is wrong but I am not sure. It works in the Production environment but not in the Sandbox where this response comes from.

 

Thanks!

Niklas

 

Hi, 

A stupid question probably and probably in the wrong place too, but I need to be certain.

 

Regarding the email that was sent to System administrators "Action Required: Upcoming Changes to your EU0 Service".

 

One bullet point says avoiding hard coding integrations to specific server instance URLs (for example na6.salesforce.com).

 

I assume these will still be ok?

- www.salesforce.com

- emea.salesforce.com

- test.salesforce.com

 

Thanks / Niklas

More than a year ago we took the enterprise WSDL file and sent it to our integration department. They use webmethods and imported it to get all methods and variables. I think that the WSDL file was of version 14.

 

Now the Enterprise WSDL is of version 19.

Here's the code in the WSDL-file for the sObject. It's taken from version 19:

 

<complexType name="sObject">
<sequence>
  <element name="fieldsToNull" type="xsd:string" nillable="true" minOccurs="0" maxOccurs="unbounded" />
  <element name="Id" type="tns:ID" nillable="true" />
  </sequence>
  </complexType>

 

The WSDL file looks pretty much the same but there are a few differences:

- In version 14 there was also an element tag for a xsi-attribute in the WSDL-file.

- When looking at it in Webmethods, version 14 describes the elements with 'urn:fieldsToNull' and 'urn:Id'. Both are optional.

- When looking at it in Webmethods for version 19 these are described with 'ens:fieldsToNull' and 'ens:Id'

 

About 6 months ago we created an Apex class as a webservice that would do similar things with a custom object as are done on standard objects described by the Enterprise WSDL.

 

 The integration department wants us to deliver on the same structure though as the enterprise WSDL.

 For the above example those fields/elements are instead described with 'tns:fieldToNull' and 'tns:Id'. The difference is as you can see 'tns' but also that it says 'fieldToNull' and not 'fieldsToNull'. Furthermore 'tns:Id' is required and not optional. 

 

Is there a way to manipulate these values? The webservice method does upserts and therefore the Id should be optional in my opinion. Can someone explain how I am suppose to work with this and what ens, urn and tns means, works and can be adjusted? I suspect it has something to do with namespaces.

 

Another example in the same manner is how results of upserts are treated. In the Enterprise WSDL UpsertResult is used which has four elements: created, errors, id and success. I am not allowed to use this one in the Apex class web service and return it from my method. Instead I have to create my own. This works alright but my fields are set as optional and I have no idea of how to set them or some of them as required.

 

Thanks / Niklas

 

Hi, I am wondering if there is a way to hide opportunities or accounts or other objects for a user with a specific profile or role based on field values on the particular object?

 

Thanks / Niklas

Hi,
I have an external source and a couple of external objects defined and synched.
For one of the objects I have created an indirect lookup to the Account and a specified field which matches the external record with the account record. On the account page layout there is a related list with the external objects related to this account via this indirect lookup.

Now this related list seems to have a limit of 100 records.
It is possible to query the external objects via SOQL from the developer console for example and although the external records are way more than hundred there always seems to be a limit of 100 for how much that is allowed to display via the related list. 

Anyone know if this is a limit we have to live with or if there is anyway to adjust it?. For us this is very important and not really usuable else.

Thanks / Niklas

Hi,

I am a beginner to Salesforce development.

 

By default, from the Partner related list on the Opportunity, you can create OpportunityPartner junction objects between an Opportunity and a Partner Account. We want to modify this page. Unfortunately this object is not very easy to customize.

 

We have come up with a solution that works for us though.

I am going to create a Visualforce page with standardController 'Opportunity' and with an extension class.

The Visualforce page should be built up to look similar to the current Partner Edit page. 

 

So we are going to have five rows of partners where you can choose if its primary or not, the AccountToId and the Role. You don't have to fill in information on all rows.

 

I am not at all done with this yet and many things are not working as I would like them too (the radio buttons for instance). But currently I am stuck with the problem that the getters for the partner variables work but the setters does not. In other words I know that the getPartner methods have been run since I have seen this in the debug logs. The setters are never run though and this becomes obvious and also a problem when I try to insert one of the defined partners in the save method . I get an error that the field 'AccountToId' is a required field and should have a value:

 

 

Insert failed. First exception on row 0; first error: REQUIRED_FIELD_MISSING, Required fields are missing: [AccountToId]: [AccountToId]

 

 

Furthermore as you can see I have chosen to use the Partner object since I am not allowed to create OpportunityPartner objects. But when a Partner object gets created an OpportunityPartner object also does so that shouldn't be a problem.

 

VisualForce page:

 

<apex:page title="Partners: {!Opportunity.Name}" standardController="Opportunity" extensions="PartnerEditExt" showheader="true" sidebar="true" id="thePage"> <apex:sectionHeader title="Partners" subtitle="{!Opportunity.Name}" id="partnerEditSectionId" help="javascript:openPopupFocusEscapePounds(%27/help/doc/user_ed.jsp?loc=help&target=partners_edit.htm&section=Partners&showSplash=true%27, %27Help%27, 700, 600, %27width=700,height=600,resizable=yes,toolbar=yes,status=no,scrollbars=yes,menubar=yes,directories=no,location=no,dependant=no%27, false, false);"></apex:sectionHeader> <apex:pageMessages /> <apex:form id="theForm"> <apex:pageBlock title="Partners Edit"> <apex:pageBlockSection columns="3"> <!-- Headings --> <apex:outputText value="Primary" style="font-weight:bold" /> <apex:outputText value="Partner" style="font-weight:bold" /> <apex:outputText value="Role" style="font-weight:bold" /> <apex:pageBlockSectionItem > <apex:inputField value="{!Partner0.isPrimary}" id="fromPartnerPrimary0"/> </apex:pageBlockSectionItem> <apex:pageBlockSectionItem > <apex:outputText value="No Partner" id="noPartnerAccount"/> </apex:pageBlockSectionItem> <apex:pageBlockSectionItem /> <!-- Partner 1 row --> <apex:pageBlockSectionItem > <apex:inputField value="{!Partner1.isPrimary}" id="fromPartnerPrimary1" /> </apex:pageBlockSectionItem> <apex:pageBlockSectionItem > <apex:inputField value="{!Partner1.AccountToId}" id="fromPartner1" /> </apex:pageBlockSectionItem> <apex:pageBlockSectionItem > <apex:inputField value="{!Partner1.Role}" id="fromPartnerRole1" /> </apex:pageBlockSectionItem> <!-- Partner 2 row --> <apex:pageBlockSectionItem > <apex:inputField value="{!Partner2.isPrimary}" id="fromPartnerPrimary2"/> </apex:pageBlockSectionItem> <apex:pageBlockSectionItem > <apex:inputField value="{!Partner2.AccountToId}" id="fromPartner2"/> </apex:pageBlockSectionItem> <apex:pageBlockSectionItem > <apex:inputField value="{!Partner2.Role}" id="fromPartnerRole2"/> </apex:pageBlockSectionItem> <!-- Partner 3 row --> <apex:pageBlockSectionItem > <apex:inputField value="{!Partner3.isPrimary}" id="fromPartnerPrimary3"/> </apex:pageBlockSectionItem> <apex:pageBlockSectionItem > <apex:inputField value="{!Partner3.AccountToId}" id="fromPartner3"/> </apex:pageBlockSectionItem> <apex:pageBlockSectionItem > <apex:inputField value="{!Partner3.Role}" id="fromPartnerRole3"/> </apex:pageBlockSectionItem> </apex:pageBlockSection> <apex:pageBlockButtons location="bottom"> <apex:commandButton action="{!save}" value="Save" immediate="true" /> <apex:commandButton action="{!Cancel}" value="Cancel" /> </apex:pageBlockButtons> </apex:pageBlock> </apex:form> </apex:page>

 

The Apex extension class:

 

public with sharing class PartnerEditExt { final Opportunity opp; Partner partner0 = null; Partner partner1 = null; Partner partner2 = null; Partner partner3 = null; ID oppId; ID accId; ID noPartnerAccId = [select id from Account where Name = 'no partner'].Id; /* Constructor */ public PartnerEditExt(ApexPages.StandardController controller) { opp = (Opportunity)controller.getRecord(); oppId = controller.getRecord().Id; accId = [select AccountId from Opportunity where Id = :oppId].AccountId; partner0 = new Partner(OpportunityId=oppId); partner1 = new Partner(OpportunityId=oppId); partner2 = new Partner(OpportunityId=oppId); partner3 = new Partner(OpportunityId=oppId); } /* Save action Insert the specified partners */ public void save() { // Currently no intelligent logic here // I just want to test that partner1 can be inserted insert partner1; } /* Cancel action Redirect user back to opportunity */ public PageReference cancel() { String curr = '/'+ApexPages.currentPage().getParameters().get('id'); PageReference pageref = new Pagereference(curr); return pageref; } /* Getters and Setters for the partner variables */ public Partner getPartner0() { return partner0; } public void setPartner0(Partner p) { partner0 = p; } public Partner getPartner1() { return partner1; } public void setPartner1(Partner p) { partner1 = p; } public Partner getPartner2() { return partner2; } public void setPartner2(Partner p) { partner2 = p; } public Partner getPartner3() { return partner3; } public void setPartner3(Partner p) { partner3 = p; } }

 

 Some of you might wonder why we didn't choose to use a custom object instead. We though of this but made the assumption that this work would take less time and also be less risky.

 

What have I done wrong?

I think I might miss some basic understanding here. A solution to my problem with a good explanation would be very welcome!

 

 

Thanks / Niklas

 

 

Hi,
I have an external source and a couple of external objects defined and synched.
For one of the objects I have created an indirect lookup to the Account and a specified field which matches the external record with the account record. On the account page layout there is a related list with the external objects related to this account via this indirect lookup.

Now this related list seems to have a limit of 100 records.
It is possible to query the external objects via SOQL from the developer console for example and although the external records are way more than hundred there always seems to be a limit of 100 for how much that is allowed to display via the related list. 

Anyone know if this is a limit we have to live with or if there is anyway to adjust it?. For us this is very important and not really usuable else.

Thanks / Niklas

Hi,
My understanding was, we can not use 'webservice' keyword in trigger. However, I saw in apex guide, we can use 'webservice' key word.

You can only use the webService keyword in a trigger when it is in a method defined as asynchronous; that is, when the
method is defined with the @future keyword.


Can someone clear me this idea? How to write a code here, any example..

Thank you.
 
  • January 08, 2015
  • Like
  • 0
Hi All, 

I wanted to add Pipe in a string to send it make a webservice call . but Apex changes | to &#124;

is there a way for me keep | as it is instead of changing the character.

Example :

String pipeString = 'Salesforce|Salesforce';
system.debug returns  :
Salesforce&#124;Salesforce

is there anyway i get aound this?



 
I have created a page for dynamic search using Using jeffdouglas blog wit hsome modifications. Its not working form me. Am i wrong Anywhere?

CLASS:

public with sharing class vki2{

 private String soql {get;set;}
 
  public List<Contact> contacts {get;set;}

 
  public String sortDir {
    get  { if (sortDir == null) {  sortDir = 'desc'; } return sortDir;  }
    set;
  }

 
  public String sortField {
    get  { if (sortField == null) {sortField = 'Name'; } return sortField;  }
    set;
  }

 
  public String debugSoql {
    get { return soql + ' order by ' + sortField + ' ' + sortDir; }
    set;
  }

 
  public vki2() {
    soql = 'select Name, Leadsource from contact';
    runQuery();
  }

 
  public void toggleSort() {
    
    sortDir = sortDir.equals('asc') ? 'desc' : 'asc';
   
    runQuery();
  }

 
  public void runQuery() {

    try {
      contacts = Database.query(soql + ' order by ' + sortField + ' ' + sortDir);
    } catch (Exception e) {
      ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.ERROR, 'Oops!'));
    }

  }

    public PageReference runSearch() {

    String Name= Apexpages.currentPage().getParameters().get('Name');
     String Leadsource= Apexpages.currentPage().getParameters().get('Leadsource');
    
    soql = 'select Name,Leadsource from contact';
    
    if (!Name.equals(''))
      soql +=  ' and Name LIKE \''+String.escapeSingleQuotes(Name)+'%\'';
       if (!Leadsource.equals(''))
      soql += ' and Leadsource LIKE \''+String.escapeSingleQuotes(Leadsource)+'%\'';
  
    runQuery();

    return null;
  }

 
  public List<String> Leadsource{
    get {
      if (Leadsource== null) {

        Leadsource= new List<String>();
        Schema.DescribeFieldResult field = Contact.Leadsource.getDescribe();

        for (Schema.PicklistEntry f : field.getPicklistValues())
          Leadsource.add(f.getLabel());

      }
      return Leadsource;          
    }
    set;
  }

}


VF:

<apex:page controller="vki2" sidebar="false">
  <apex:form >
  <apex:pageMessages id="errors" />
  <apex:pageBlock title="Find!" mode="edit">
  <table width="100%" border="0">
  <tr>  
    <td width="200" valign="top">
      <apex:pageBlock title="Parameters" mode="edit" id="criteria">
      <script type="text/javascript">
      function doSearch() {
        searchServer(
          document.getElementById("Name").value,
         
          document.getElementById("Leadsource").options[document.getElementById("Leadsource").selectedIndex].value
          );
      }
      </script>
      <apex:actionFunction name="searchServer" action="{!runSearch}" rerender="results,debug,errors">
          <apex:param name="Name" value="" />
          <apex:param name="Leadsource" value="" />
      </apex:actionFunction>
      <table cellpadding="2" cellspacing="2">
      <tr>
        <td style="font-weight:bold;">Name<br/>
        <input type="text" id="Name" onkeyup="doSearch();"/>
        </td>
      </tr>
      <tr>
        <td style="font-weight:bold;">Leadsource<br/>
          <select id="leadsource" onchange="doSearch();">
            <option value=""></option>
            <apex:repeat value="{!Leadsource}" var="category">
              <option value="{!category}">{!category}</option>
            </apex:repeat>
          </select>
        </td>
      </tr>
      </table>
      </apex:pageBlock>
    </td>
    <td valign="top">
    <apex:pageBlock mode="edit" id="results">
        <apex:pageBlockTable value="{!contacts}" var="o">
            <apex:column >
                <apex:facet name="header">
                    <apex:commandLink value="Name" action="{!toggleSort}" rerender="results,debug">
                        <apex:param name="sortField" value="Name" assignTo="{!sortField}"/>
                    </apex:commandLink>
                </apex:facet>
                <apex:outputField value="{!o.Name}"/>
            </apex:column>
            <apex:column >
                <apex:facet name="header">
                    <apex:commandLink value="Leadsource" action="{!toggleSort}" rerender="results,debug">
                        <apex:param name="sortField" value="Leadsource" assignTo="{!sortField}"/>
                    </apex:commandLink>
                </apex:facet>
                <apex:outputField value="{!o.Leadsource}"/>
            </apex:column>
        </apex:pageBlockTable>
    </apex:pageBlock>
    </td>
  </tr>
  </table>
  </apex:pageBlock>
  </apex:form>
</apex:page>

Thank U
 
Hi,
I was playing around with Lightning components and created an input field which on the onchange event through the client contoller and helper calls the server controller to get a list of accounts which are returned to the helper via the callback function and then set to an attribute in the component page. I am printing these in the controller using the aura:iteration tag. For each of the accounts I am displaying I want to link them to open the account page layout in Salesforce1.

Is there an aura ui component for this? I solved it by using the below syntax, but it doesn't seem right. And although it works I don't get a back arrow to go back to the list which you can see if you are looking at an account record that you have navigated to from the 'All Accounts' list for example,
<aura:iteration items="{!v.accs}" var="a">
    <a href="{!'/one/one.app#/sObject/' + a.Id + '/view?t=1414009941155'}">{!a.Name}</a>
</aura:iteration>
Currently I am using this aura reference (https://eu3.lightning.force.com/auradocs/reference.app#) but it is not very extensive.
So is this coming later or am I missing something that I should be aware of?

Thanks / Niklas
 
Hi,

I have the following picklist (it's basically the Stage field of an Opportunity):

Product Evaluation (25%)  
Prospect (Quote) (50%)
Negotiating (60%)
Well Positioned (75%)
Closed Won (100%)
Canceled (0%)
Closed Lost (0%)

I want to filter out  Well Positioned once in an Apex statement, for example:

AggregateResult[] arId = ([select Partner__c, sum(OBPS__c) amt, sum(OBPE_Weighted__c) wamt, sum(Probability) wct, count(amount) ct from Opportunity where amount <> null and Partner__c <> null and and OBPS__c > 0 group by Partner__c]);

How can I filter by picklist values?

Hi,

 

I am new to visualforce.This is a simple requirement,but i am not able to get this work.

 

From account detail page ,i need to navigate to a new page on a button click.

On the new page,all the contacts associated with that account should be displayed and a button called "show opportunities".opportunities associated with the account should be rendered on that button click only.

BUt even if i use the rerender attribute,opportunities are always displayed on page.I used the Account standard controller.

 

Can someone guide me?

I was hoping I could get some help creating an inline visualforce page on my Opportunity page layout.

 

The purpose of this page would be to display instructions to the sales rep based on the opportunity's current stage. And then when the opportunity stage changes, the content of the inline visual force page would change and display the new instructions for the new stage selected.

 

Example:

 

First opportunity stage = Sales Qualified Lead

 

Inline visualforce page would display static text specific to the Sales Qualified Lead stage. Something like this:

 

1) Make sure you walk them through the standard checklist document (html link to doc on intranet)

2) Make sure you review the ABC document with them (html link to doc on intranet)

 

Then when the sales rep moves the opportunity to the next stage:

 

Second opportunity stage = Needs Analysis

 

The visualforce page's content changes and shows them a new set of instructions based on the Needs Analysis stage. Something like:

 

1) Complete the company overview presentation with them (link to PPT on intranet)

2) Demonstrate our our reporting functionality (link to doc)

 

And then the rest of the opportunity stages would work just like the above, each with specific instructions based on the stage.

 

As the sales rep progresses through our sales process and changes the sales stage they always have instructions on what they're supposed to be doing during that stage of our sales process.

 

I'm brand new to visualforce (watching the introduction to visualforce pages video now - lol) and would be very grateful if someone could give me the basic building blocks to do what I'm trying to do here and then I could take it from there.

 

Thank you!

 

- Ken

Can any one please point out what I am doing wrong , I need the id of Case_Accession__c  on click of edit in data table in text box but not getting

 

public class Worklist
{
   

    public List<Case_Accession__c> objWorklist {get;set;}
     public String var {get;set;}


    public Worklist()
    {
        objWorkList = new List<Case_Accession__c>();
        objWorkList = [Select ID,PatientName__c,PhysicianName__c  from Case_Accession__c limit 1];
    }

 

}
 }

 

 

VF Page::

 

<apex:page controller="Worklist">
     <apex:Form >
     <apex:pageBlock >
             <apex:pageblockSection >
                 <apex:dataTable id="dtWorklist" value="{!objWorklist }" var="wrklst"  cellspacing="16%">
                  <apex:column headerValue="Patient Name" >
                   <apex:outputField value="{!wrklst.PatientName__c}" />
                   </apex:column>
                   <apex:column headerValue="Physician Name" >
                   <apex:outputField value="{!wrklst.PhysicianName__c}" />
                   </apex:column>
                
                   <apex:column headerValue="Edit Case">
                   
                   <apex:commandLink value="Edit" /> 
                   <apex:param name="var" assignTo="{!var}" value="{!wrklst.id}" />  
                    </apex:column>
                  
                 </apex:dataTable>
                 <apex:inputText value="{!var}"/>
                </apex:pageblockSection>
     </apex:pageBlock>
     </apex:Form>
</apex:page>
   

Hi,

For some odd reason, I'm unable to pass the parameter using APEX:ACTIONFUNCTION.

 

Code Snippet:

 

VF PAGE:

<apex:page standardController="Service_Catalogue__c" extensions="serviceCatalogueCtrl">

<script>
function fnChange(a)
{
alert('Hello Param'+a);
testJs(a);
alert(a);
}

<apex:form>

<apex:actionFunction name="testJs" action="{!testJs}" rerender="" >
<apex:param value="" id="y" assignTo="{!subCategory}" />
</apex:actionFunction>

 

<apex:inputField value="{!Service_Catalogue__c.Category__c}"/>
<apex:inputField value="{!Service_Catalogue__c.SubCategory__c}" onchange="fnChange(this.value);" />

</apex:form>

</apex:page>

 

APEX CLASS:

public class serviceCatalogueCtrl {

 public string subCategory{get;set;}

public serviceCatalogueCtrl(ApexPages.StandardController controller) {
}

public PageReference testJs()
{
system.debug('Hello subCategory @@'+subCategory);

return null;
}

}

 

 

Service catalogue is my custom object which has 2 picklist fields category and subcategory.

I want to pass the value that I selected in subcategory field and pass it to my controller for further processing.

 

But for some reason subcategory value is not getting set while trying to set in actionfunction.

 

It looks simple but I'm missing something.

Many thanks in advance for your help:)

Thank You!

 

Hi Developers , 

 

Can anyone help me in resolving this issue ?

 

ERROR : the image is not getting display in a page .

 

How to show loading image while Ajax call in Visualforce? OR how to show image in <apex:actionStatus> tag in Visualforce?

 

<apex:page >
 
 <div style="position:absolute;top:20px;left: 50%;">
 
      <apex:actionStatus id="refreshContent" >
 
             <apex:facet name="start" >
 
               <apex:image url="{!$Resource.waterlilies}" />
 
       </apex:facet>
 
      </apex:actionStatus>
 
  </div>
 
</apex:page>

 

Thanks in Advance

  • September 12, 2013
  • Like
  • 0

 

 

I am trying to write a trigger and keep getting errors for too many soql queries.  Rather than post the code I decided to just list my requirements and see if anyone has some suggestions.  

 

First, a little background info:

 

1. The object is CASE

2. Custom lookup field on Case named Parent__c

     That field is a lookup to the case object.  (Will link multiple cases to one case).

3. Custom NUMBER field on Case named Iteration__c

     This field is meant to hold the number of cases that are related to it.  

 

 

The requirements:

 

For every case that is updated or inserted and has a value in Parent__c

I need the trigger to find all cases that have the same value in that field and update the the 

Iteration__c field with the number of total cases with that same value in Parent__c.  

The parent record will also need its iteration__c field updated with the same number.

 

 

The logic seems pretty straight forward, but when I try to Bulkify the trigger, I keep running into limit 

issues.  

 

Any suggestions would be greatly appreciated.

 

  • September 11, 2013
  • Like
  • 0

Our org has a search controller that pulls contacts by zipcode and city. I am trying to add the ability to search by State and Contact Owner. The class compiles and the test class passes with 80% coverage (not great, I know). But when I try to deploy into production, it's not recognizing Owner__r.Name. Can someone look into my code to see how I would properly reference the Contact Owner as another viable search option?? If the VisualForce page is needed, it can be provided.

 

Error:

 

Test_TerritorySearchController.testController() Class 167   Failure Message: "System.QueryException: Didn't understand relationship 'Owner__r' in field path. If you are attempting to use a custom relationship, be sure to append the '__r' after the custom relationship name. Please reference your WSDL or the describe call for the appropriate names.", Failure Stack Trace: "Class.TerritorySe...

 

Class:

 

public with sharing class TerritorySearchController
{
    public String searchType { public get; public set; }  
    public String searchValue { public get; public set; }
    public String zipcode { public get; public set; }
    public String state { public get; public set; }
    public String owner { public get; public set; }
    public String contactType { public get; public set; }  //Contact_Type__c
    public String statusType { public get; public set; } //Producer_Status__c / Prospect_Status__c
    
    public String citySearch { public get; public set; }
    public String citySearchResults { public get; public set; }
    public String citySearchSelected { public get; public set; }
    
    public String stateSearch { public get; public set; }
    public String stateSearchResults { public get; public set; }
    public String stateSearchSelected { public get; public set; }
    
    public String ownerSearch { public get; public set; }
    public String ownerSearchResults { public get; public set; }
    public String ownerSearchSelected { public get; public set; }
    
    public List<Contact> reps { public get; private set; }
    public Boolean mapView { public get; private set; }
    
    public TerritorySearchController()
    {
        this.reps=new List<Contact>();
        this.searchType = getParam('searchType', 'zipcode');
        this.searchValue = getParam('searchValue', '');
        this.zipcode = getParam('zipcode', '');
        this.state = getParam('state', '');
        this.owner = getParam('owner', '');
        this.contactType = getParam('contactType', '');
        this.statusType = getParam('statusType', '');
        this.citySearch = getParam('citySearch', '');
        this.citySearchResults = '';
        this.citySearchSelected = '';
        this.stateSearch = getParam('stateSearch', '');
        this.stateSearchResults = '';
        this.stateSearchSelected = '';
        this.ownerSearch = getParam('ownerSearch', '');
        this.ownerSearchResults = '';
        this.ownerSearchSelected = '';
        this.mapView = getBooleanParam('mapView', false);
    }
    
    public String getParam(String name, String defaultValue) {
        String value = ApexPages.currentPage().getParameters().get(name);
        return value == null ? defaultValue : value;
    }
    
    public Boolean getBooleanParam(String name, Boolean defaultValue) {
        String value = ApexPages.currentPage().getParameters().get(name);
        return value == null ? defaultValue : 'true'.equalsIgnoreCase(value);
    }
    
    public PageReference processSearch()
    {
        PageReference p=null;
        
        if (this.searchType=='city')
            p=searchCities();
        else if(this.searchType=='state')
                p=searchStates();
        else if(this.searchType=='zipcode')
                p=searchZips();
        else if(this.searchType=='owner')
                p=searchOwners();
            
        return p;
    }
    
    public PageReference searchZips()
    {
        List<String > lZips=new List<String>();
        lZips.add(this.searchValue);
        this.reps=getContactsByZip(lZips);
        return null;
    }
    
    public PageReference searchStates()
    {
        List <String > lStates = new List<String>();
        lStates.add(this.searchValue);
        this.reps=getContactsByState(lStates);
        return null;
    }
    
    public PageReference searchOwners()
    {
        List<String > lOwners=new List<String>();
        lOwners.add(this.searchValue);
        this.reps=getContactsByOwner(lOwners);
        return null;
    }
    
        public PageReference searchForCities()
    {
        String str='';
        this.citySearchResults='[';
        String strCity=this.citySearch; //Apexpages.currentPage().getParameters().get('citySearch');
        String strSOQL='SELECT Id, Name, City__c, State__c FROM Zip_Codes__c WHERE City__c LIKE \''+strCity+'%\' ORDER BY State__c LIMIT 10';
        System.debug(strSOQL);
        List<Zip_Codes__c> lZ=Database.query(strSOQL);
        Set<String> sZ=new Set<String>();
        
        for(Zip_Codes__c z : lZ)
        {
            str=z.City__c+', '+z.State__c;
            
            if(!sZ.contains(str))
            {
                if(sZ.size()>0)
                  this.citySearchResults=this.citySearchResults+',';
                  
                this.citySearchResults=this.citySearchResults+' { value: \''+z.Id+'\', label: \''+str.replace('\'', '\\\'')+'\'} ';
                sZ.add(str);
            }
        }
                    
        this.citySearchResults=this.citySearchResults+']';
        return null;
    }
    
    public PageReference searchCities()
    {
        this.reps=getContactsByCity(this.searchValue);
        return null;
    }

    public PageReference searchForStates()
    {
        String str='';
        this.stateSearchResults='[';
        String strState=this.stateSearch; //Apexpages.currentPage().getParameters().get('stateSearch');
        String strSOQL='SELECT Id, Name, City__c, State__c FROM Zip_Codes__c WHERE State__c LIKE \''+strState+'%\' ORDER BY City__c LIMIT 10';
        System.debug(strSOQL);
        List<Zip_Codes__c> lS=Database.query(strSOQL);
        Set<String> sS=new Set<String>();
        
        for(Zip_Codes__c s : ls)
        {
            str=s.City__c+', '+s.State__c;
            
            if(!sS.contains(str))
            {
                if(sS.size()>0)
                  this.stateSearchResults=this.stateSearchResults+',';
                  
                this.stateSearchResults=this.stateSearchResults+' { value: \''+s.Id+'\', label: \''+str.replace('\'', '\\\'')+'\'} ';
                sS.add(str);
            }
        }
                    
        this.stateSearchResults=this.stateSearchResults+']';
        return null;
    }

        public PageReference searchForOwners()
    {
        String str='';
        this.ownerSearchResults='[';
        String strOwner=this.ownerSearch; //Apexpages.currentPage().getParameters().get('ownerSearch');
        String strSOQL='SELECT Id, Owner__r.Name, City__c, State__c FROM Zip_Codes__c WHERE Owner__r.Name LIKE \''+strOwner+'%\' ORDER BY Owner__r.LastName LIMIT 10';
        System.debug(strSOQL);
        List<Zip_Codes__c> lO=Database.query(strSOQL);
        Set<String> sO=new Set<String>();
        
        for(Zip_Codes__c o : lO)
        {
            str=o.City__c+', '+o.State__c+', '+o.Owner__c;
            
            if(!sO.contains(str))
            {
                if(sO.size()>0)
                  this.ownerSearchResults=this.ownerSearchResults+',';
                  
                this.ownerSearchResults=this.ownerSearchResults+' { value: \''+o.Id+'\', label: \''+str.replace('\'', '\\\'')+'\'} ';
                sO.add(str);
            }
        }
                    
        this.ownerSearchResults=this.ownerSearchResults+']';
        return null;
    }

    public Integer getRepCount()
    {
        return this.reps.size();
    }
    
    private List<Contact> getContactsByZip(List<String> lZips)
    {   
        List<Contact> lContacts=new List<Contact>();
        
        if(contactType==null)
            contactType=''; 
        
        String strZipCodes=' \'0\'';
        String strSOQL='SELECT ID, Name, MailingStreet, MailingCity, MailingState, MailingPostalCode, MailingCountry, Phone, Email, Contact_Type__c, Prospect_Status__c, Producer_Status__c, Broker_Dealer_Name__c FROM Contact ';
        
        for(String s: lZips)
        {
            if(s.trim()!='')
            {
                strZipCodes=strZipCodes+' OR mailingpostalcode like \''+s+'%\' ';
                this.zipcode=s;
            }
        }
         
        strSOQL=strSOQL+' WHERE (MailingPostalCode like' + strZipCodes + ') ';
      //strSOQL=strSOQL+' AND SA_Status__c = \'NS REIT - Signed Selling Agreement\' ';
        strSOQL=strSOQL+' AND ( NS_Income_II_SA_Status__c = \'NS I2 - Signed Selling Agreement\' OR NS_HI_SA_Status__c = \'NS HI - Signed Selling Agreement\' )';
        strSOQL=strSOQL+' AND Contact_Type__c != \'POND List\' ';
        strSOQL=strSOQL+' AND Contact_Type__c != null ';
      //strSOQL=strSOQL+' AND contact.owner !=null ';
        
        //
        // Handle producer/prospect types.
        //
        
        if ('Un-Profiled'.equalsIgnoreCase(contactType)) {
            strSOQL += ' AND Contact_Type__c = \'Un-Profiled\' ';
        } else if ('All Producers'.equalsIgnoreCase(contactType)) {
            strSOQL += ' AND Contact_Type__c = \'Producer\'';
        } else if ('A Producers'.equalsIgnoreCase(contactType)) {
            strSOQL += ' AND Contact_Type__c = \'Producer\' AND Producer_Status__c like \'Producer A-%\'';
        } else if ('B Producers'.equalsIgnoreCase(contactType)) {
            strSOQL += ' AND Contact_Type__c = \'Producer\' AND Producer_Status__c like \'Producer B-%\'';
        } else if ('C Producers'.equalsIgnoreCase(contactType)) {
            strSOQL += ' AND Contact_Type__c = \'Producer\' AND Producer_Status__c like \'Producer C-%\'';
        } else if ('Sphere Of Influence Producers'.equalsIgnoreCase(contactType)) {
            strSOQL += ' AND Contact_Type__c = \'Producer\' AND Producer_Status__c like \'Sphere of Influence%\'';
        } else if ('All Prospects'.equalsIgnoreCase(contactType)) {
            strSOQL += ' AND Contact_Type__c = \'Prospect\'';
        } else if ('A Prospects'.equalsIgnoreCase(contactType)) {
            strSOQL += ' AND Contact_Type__c = \'Prospect\' AND Prospect_Status__c like \'Prospect A-%\'';
        } else if ('B Prospects'.equalsIgnoreCase(contactType)) {
            strSOQL += ' AND Contact_Type__c = \'Prospect\' AND Prospect_Status__c like \'Prospect B-%\'';
        } else if ('C Prospects'.equalsIgnoreCase(contactType)) {
            strSOQL += ' AND Contact_Type__c = \'Prospect\' AND Prospect_Status__c like \'Prospect C-%\'';
        } else if ('Sphere Of Influence Prospects'.equalsIgnoreCase(contactType)) {
            strSOQL += ' AND Contact_Type__c = \'Prospect\' AND Prospect_Status__c like \'Sphere of Influence%\'';
        }
        
        System.debug(strSOQL);
        lContacts=Database.query(strSOQL);
        return lContacts;
    }
    
    private List<Contact> getContactsByCity(String strCityState)
    {
        List<Contact> lContacts=new List<Contact>();
        Integer i=strCityState.lastIndexOf(',');
        
        if(i<1)
            return lContacts;
            
        String strCity=strCityState.substring(0, i).trim();
        String strState=strCityState.substring(i+1).trim().toUpperCase();
        
        System.debug('SELECT Id, Name FROM Zip_Codes__c WHERE City__c =\''+strCity+'\' AND State__c=\''+strState+'\' ORDER BY longitude__c');
        List<Zip_Codes__c> lZ=[SELECT Id,Name FROM Zip_Codes__c WHERE City__c=:strCity AND State__c=:strState ORDER BY longitude__c];
        List<String> lZips=new List<String>();  
        
        for(Zip_Codes__c z : lZ)
        {
            lZips.add(z.Name);    
        }
        
        lContacts=getContactsByZip(lZips);
        return lContacts;       
    }
    
    
    private List<contact> getContactsByState (List<String> lStates)
    {
        list<Contact> llContacts=new List<Contact>();
        
        if(contactType==null)
            contactType='';
        
        String strStates=' \'0\'';
        String strSOQL='SELECT Id, Name, City__c, State__c FROM Zip_Codes__c WHERE City__c=:strCity AND State__c=:strState ORDER BY City__c LIMIT 10';
        
      for(String s: lStates)
        {
            if(s.trim()!='')
            {
                strStates=strStates+' OR MailingState like \''+s+'%\' ';
                this.state=s;
            }
        }
        return llContacts; 
    }
    
    private List<Contact> getContactsByOwner(List<String> lOwner)
    {
        List<Contact> lllContacts=new List<Contact>();
        
         if(contactType==null)
            contactType='';
        
        String strOwner=' \'0\'';
        String strSOQL='select Id, Owner__r.Name, longitude__c, latitude__c, Territory__c, City__c, State__c from Zip_Codes__c WHERE Owner__r.Name=:strOwner';
        
        for(String o: lOwner)
        {
            if(o.trim()!='')
            {
                strOwner=strOwner+' OR Name like \''+o+'%\' ';
                this.owner=o;
            }
        }
        return lllContacts;
    }

    
    public Boolean getIsDisabledDownloadCSV() {
        return reps == null || reps.size() == 0;
    }
    
    public PageReference redirectToCSV() {
        processSearch();
        
        String documentData = '';
        documentData += '"Name",';
        documentData += '"Broker_Dealer_Name__c",';
        documentData += '"MailingStreet",';
        documentData += '"MailingCity",';
        documentData += '"MailingState",';
        documentData += '"MailingPostalCode",';
        documentData += '"Phone",';
        documentData += '"Email",';
        documentData += '"Last Completed Event",';
        documentData += '"Owner__r.Name",';
        documentData += '"Contact_Type__c"\r\n';
        
        for(Contact contact : reps) {
            documentData += '"' + contact.Name + '",';
            documentData += '"' + contact.Broker_Dealer_Name__c + '",';
            documentData += '"' + contact.MailingStreet + '",';
            documentData += '"' + contact.MailingCity + '",';
            documentData += '"' + contact.MailingState + '",';
            documentData += '"' + contact.MailingPostalCode + '",';
            documentData += '"' + contact.Phone + '",';
            documentData += '"' + contact.Email + '",';
            documentData += '"' + contact.Last_Event_Date__c + '",';
            documentData += '"' + contact.Owner + '",';
            documentData += '"' + contact.Contact_Type__c + '"\r\n';
        }
        
        Document document = new Document();
        document.Body = Blob.valueOf(documentData);
        document.ContentType = 'text/csv';
        document.FolderId = UserInfo.getUserId();
        document.Name = 'Territory Search - CSV Export - ' + DateTime.now().format() + '.csv';
        insert document;
        
        PageReference pageReference = new PageReference('/servlet/servlet.FileDownload?file=' + document.Id);
        pageReference.setRedirect(true);
        return pageReference;
    }
    
    public String getMapViewUrl() {
        PageReference pageReference = System.Page.TerritorySearch;
        pageReference.getParameters().put('searchType', searchType);
        pageReference.getParameters().put('searchValue', searchValue);
        pageReference.getParameters().put('zipcode', zipcode);
        pageReference.getParameters().put('contactType', contactType);
        pageReference.getParameters().put('statusType', statusType);
        pageReference.getParameters().put('citySearch', citySearch);
        pageReference.getParameters().put('stateSearch', stateSearch);
        pageReference.getParameters().put('ownerSearch', ownerSearch);
        pageReference.getParameters().put('mapView', 'true');
        return pageReference.getUrl();
    }
}

 

Test Class:

 

@isTest
private class Test_TerritorySearchController 
{

    static testMethod void testController()
    {
        TerritorySearchController tsc=new TerritorySearchController();
        tsc.searchValue='00001';
        tsc.searchType='zipcode';
        tsc.processSearch();
        //System.assertNotEquals(tsc.getRepCount(), 0);
        
        tsc.contactType='Prospect';
        tsc.statusType='Prospect A- $1M+ potential business/yr';
        tsc.processSearch();
        //System.assertNotEquals(tsc.getRepCount(), 0);

        tsc.contactType='Producer';
        tsc.statusType='Producer A- $1M+ potential business/yr';
        tsc.processSearch();
        //System.assertNotEquals(tsc.getRepCount(), 0);
        
        tsc.contactType='Prospect';
        tsc.statusType='Prospect B- $1M+ potential business/yr';
        tsc.processSearch();
        //System.assertNotEquals(tsc.getRepCount(), 0);

        tsc.contactType='Producer';
        tsc.statusType='Producer B- $1M+ potential business/yr';
        tsc.processSearch();
        //System.assertNotEquals(tsc.getRepCount(), 0);
        
        
        tsc.contactType='Prospect';
        tsc.statusType='Prospect C- $1M+ potential business/yr';
        tsc.processSearch();
        //System.assertNotEquals(tsc.getRepCount(), 0);

        tsc.contactType='Producer';
        tsc.statusType='Producer C- $1M+ potential business/yr';
        tsc.processSearch();
        //System.assertNotEquals(tsc.getRepCount(), 0);
        
        
        tsc.contactType='Prospect';
        tsc.statusType='Prospect Sphere of Influence- $1M+ potential business/yr';
        tsc.processSearch();
        //System.assertNotEquals(tsc.getRepCount(), 0);

        tsc.contactType='Producer';
        tsc.statusType='Producer Sphere of Inlfuence- $1M+ potential business/yr';
        tsc.processSearch();
        //System.assertNotEquals(tsc.getRepCount(), 0);

        tsc.searchValue='Ridgefield, CT';
        tsc.searchType='city';
        tsc.zipcode='';
        tsc.processSearch();
        //System.assertNotEquals(tsc.getRepCount(), 0);
        
        tsc.searchValue='Sean Briceno';
        tsc.searchType='owner';
        tsc.processSearch();
        //System.assertNotEquals(tsc.getRepCount(), 0);
        
        tsc.searchZips();
        tsc.getRepCount();
        
        tsc.citySearch='West';
        tsc.searchForCities();
        
        tsc.searchCities();
        tsc.searchForCities();
        
        tsc.searchStates();
        tsc.searchForStates();
        
        tsc.searchOwners();
        tsc.searchForOwners();
        
        tsc.redirectToCSV();
        tsc.getMapViewUrl();
    }
}

 

When talking to another developer today we came across a question that we can't find the answer to so I was hoping someone here knew the answer.  I know that you can create a visualforce page with more than one extension.  My questions are:

1. Why would you use more than one?

2. If you have more that one in what order does visualforce look for your method?

3. What happens if you have a method with the same name on different extensions?

  • September 06, 2013
  • Like
  • 2

I'd like to share some data across 2 visualforce pages,  so I developed 2 pages that share a single controller:

PageOne

<apex:page controller="PageOne">
    <apex:form >
        <apex:inputText value="{!ThingOne}"/>
        <apex:commandButton value="Next" action="{!Next}"/>
    </apex:form>
</apex:page>

 and PageTwo 

<apex:page controller="PageOne">
    <apex:form >
        <apex:inputText value="{!ThingOne}"/>
        <apex:commandButton value="Previous" action="{!Previous}"/>
    </apex:form>
</apex:page>

 share

public with sharing class PageOne {

    public PageReference Previous() {
        return new PageReference('/apex/PageOne');
    }

    public PageReference Next() {
        return new PageReference('/apex/PageTwo');
    }

    public String ThingOne { get; set; }
}

 Which works fine and I'm happy.

 

However,  supposing Page One had a great deal of complexity and Page Two had a very simple visual output that was based on a result of this complexity.  I'd like to remove the complexity from the work to be done by Page Two,  so,  it seemed to me that the best way to do this would be to continue to share the custom controller and to use an extension on each page.  The code now reads:

PageOne:

<apex:page controller="PageOne" extensions="PageOneExt">
    <apex:form >
        <apex:inputText value="{!ThingOne}"/>
        <apex:commandButton value="Next" action="{!Next}"/>
    </apex:form>
</apex:page>
public with sharing class PageOneExt {
    public PageOne pageController;

    public PageOneExt(PageOne controller) {
        pageController = controller;
        system.debug('***pageController: ' + pageController);
    }

}

 

PageTwo:

<apex:page controller="PageOne" extensions="PageTwoExt">
    <apex:form >
        <apex:inputText value="{!ThingOne}"/>
        <apex:commandButton value="Previous" action="{!Previous}"/>
    </apex:form>
</apex:page>

 

public with sharing class PageTwoExt {
    public PageOne pageController;
    
    public PageTwoExt(PageOne controller) {
        pageController = controller;
/*
* Do a work here with data from Page One
*/ system.debug('***pageController: ' + pageController); } }

 However,  the ThingOne string is no longer shared between the pages and I don't understand why.  Am I doing something wrong or missing the point somewhere?

 

  • September 06, 2013
  • Like
  • 0

Hi,

I had developed a Visualforce page which UI looks similar to a ListView with a Search Functionality. My  Page has Executed very well but has Several Issues in UI. I had wrote my Issues after the code. Please check Below

 

<apex:page controller="PortofOriginController" showHeader="false" sideBar="false" tabStyle="Sourcing__tab" id="pg">
<head>
 <apex:message title="Error"/>
 <Style>
  .Body 
    {font-size:14px;font-family:'Calibri';}
 </Style>
 <Script type='text/javascript'>
  function noenter(ev)  {
        if (window.event && window.event.keyCode == 13 || ev.which == 13) {
            doSearchAF();
            return false;
         } else {
              return true;
         }
     }
  function writeDB()
{
   location.reload( 0 );
   return false;
}
 </Script>
</head>
<body>
<apex:form >  
   <c:Sectionheader iconsrc="{!$Resource.Port_Of_Origin}" title="Sourcing" subTitle="Port of Origin" PrintUrl="https://cs5.salesforce.com/a0R/x?fcf=00BO0000000WWES&rolodexIndex=-1&page=1" help="https://help.salesforce.com/htviewhelpdoc?id=co_view.htm&siteLang=en_US"/>
   <apex:actionRegion rendered="true">  
    <apex:outputPanel id="top" layout="block" style="
    border: 0 none;
    font-family: Calibri;
    height: 24px;
    float: right;
    margin-top: -25px;  
    width: 270px;">
      <apex:outputLabel value="Search" style="font-weight:Bold;font-family:'Calibri';padding-right:10px;font-size:14px;" for="txtSearch"/>    
      <apex:inputtext value="{!searchString}" id="txtSearch" onkeypress="return noenter(event);" />
        <span style="padding-left:5px; ">
         <apex:commandbutton id="btnGo" value="Go!" action="{!Search}" rerender="searchResults" status="blockUI" style="width:40px;"/>
        </span>
    </apex:outputPanel>
    <apex:outputPanel id="pnlSearchResults" style="margin:10px;overflow-Y:auto;" layout="block">             
       <apex:pageBlock id="searchResults" title="Port of Origin" mode="edit" tabStyle="Sourcing__tab">
       
        <apex:pageBlockButtons location="top" style="padding-left:70px;">
        <apex:commandButton action="{!URLFOR($Action.Port_of_Origin__c.New)}" value="New Port of Origin" id="blockUI" style="font-weight:bold;width:120px;"  />       
        </apex:pageBlockButtons> 
       
        <apex:pageBlockTable value="{!results}" var="a" id="tblResults">
       
          <apex:column >
            <apex:facet name="header">
               <apex:outputPanel >Action</apex:outputPanel>
            </apex:facet>
            &nbsp;<apex:outputLink title="Edit" value="/{!a.id}/e?retURL=/apex/{!$CurrentPage.Name}" 
            style="font-size:12px; color: #015BA7;font-weight: normal;text-decoration: none;">Edit</apex:outputLink>&nbsp;|&nbsp;             
           <apex:commandLink id="idToDel" reRender="searchResults" title="Delete" action="{!deleteMethod}" immediate="true" onclick="if(!confirm('Are you sure you want to delete ?')) return false;" oncomplete="writeDB();" style="font-size:12px;color: #015BA7;font-weight: normal;text-decoration: none;">Del
             <apex:param value="{!a.Id}" name="idToDel" assignTo="{!delId}"/>
            </apex:commandLink>  
          </apex:column>   
               
          <apex:column > 
           <apex:facet name="header">
            <apex:outputPanel style="">Port of Origin Name</apex:outputPanel>
           </apex:facet>
           <apex:outputLink value="/{!a.id}" id="eventlink" >{!a.Name} </apex:outputLink>  
          </apex:column>

        </apex:pageBlockTable>
       </apex:pageBlock>	
     </apex:outputPanel>
   </apex:actionRegion> 
  </apex:form>
 </body>        
</apex:page>

 

1. As for Search I have a input text box with a  command Button "Go!" i.e search Button  the problem here is when is Enter the search text and Press Enter key in my KeyBoard the Go button is not invoked , instead the New Button of below of PageBlock is being Invoked. 

It works very fine when enter search text and Manually inovkes "Go!" Button or using Mouse or Tab and Enter key.

So I want Only "Go!" Button to be invoked  after entering searchtext by Pressing Enter key.

 

2. In PageblockTable the 1st column has Edit and Delete command links. When I click the DEL command link the Entire page is being refreshes or reloaded with record being deleted... I want only a certain portion or a Output Panel or PageBlockTable to only RELOAD or REFRESHED, leaving the entire page remain Constant only certain page to be reloaded similar to inbox of gmail ... Intially I used Rendered but failed to get the required scenario.

 

-Thank you

input text fields on VF page do not seem to have autofill turned on (feature where browser "remembers" the last input on the form and provides suggestions). I also tried to provide the value "on" to "autocomplete" attribute on the input feilds via js but that didnt work. I read on a forum that autocomplete attribute needs to be turned "on" at the form level but that didnt help either. 

 

Any help would be appreciated! Thanks

I have an unusual problem. I  have developed an Apex class which implments schedulable.  I go into Setup -> Develop -> Apex Classes -> Schedule Apex and fill in the form. Now, when I'm selecting the class I just press the icon to give me a list and it only returns the one class which implements schedulable, which would appear the smart way of letting you select the class.

 

However, I get the following error -

Error: You must select an Apex class that implements the Schedulable interface.

 

I'm really baffled by this, see code below.

 

global class TimesheetWeeklyJob implements Schedulable{
    global void execute( SchedulableContext SC ) {
        WeeklyTimesheetProcess.markSubmitted();
        WeeklyTimesheetProcess.createNewSheets();
    }
}