• mtbclimber
  • PRO
  • 3051 Points
  • Member since 2003

  • Chatter
    Feed
  • 114
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 3
    Questions
  • 1164
    Replies

Hello All,

 

So I have a nice read only page that gets tons of records from the controller. The trouble is, when I write a unit test for the controller it fails because I get more than 50k records!

 

Any suggestions?

 

Thanks!

One for the admins.

 

By changing the class declaration of my page controllers (with/without sharing) I can give my classes access to standard objects that customer portal users shouldn't have access to. I'd like to know if this is a security hole and if I'm in danger of it being closed as that would mean vastly changing the user experience for my 1.7 million portal users.

 

Wes

Hi,

 

        I want to display the total account records and detail page of those records in visual force page. But i want to display the the records and detail page in visual force page only using visual force page code and  with out using the controller. Any one please help me how to reach the requirement.

 

Thanks,

Lakshmi.

I have created a Trigger on our sandbox that works great when we upsert from the Data Loader:

 

trigger ProductTrigger on NRProducts__c (before update, before insert) {

for(NRProducts__c r : Trigger.new){

if(r.Name == null){

r.Name = 'NEWPRODUCT';

}

}

}

 

I have written the following test method:

 

public class ProductTrigger {

    static testMethod void myTest() {

 

     // Create that new product record.

     NRProducts__c r = new NRProducts__c(name='NEWPRODUCT');

     insert r;

     // Verify that the name field was set as "NEWPRODUCT".

     NRProducts__c insertNRProducts = [SELECT name FROM NRProducts__c WHERE Id = :r.Id];

     System.assertEquals('NEWPRODUCT', insertNRProducts.name);

}

}

 

It compiles, however when I ran test coverage it comes back as 66% with the following

 

trigger ProductTrigger on NRProducts__c (before update, before insert) {

for(NRProducts__c r : Trigger.new){

if(r.Name == null){

r.Name = 'NEWPRODUCT';

}

}

}

 

Any thoughts on how to make the test method complete?

  • April 23, 2011
  • Like
  • 0

Hi All:

 

I am trying to assign multiple default values in String[] but its not working. Could you please help me out.

 

NOT WORKING BELOW CODE

==========================================================================

if (leadDivision.size()!=0) {
             for(Integer k =0; k < leadDivision.size() ;k++)
             {            
                 userDivisionName=userDivisionName+'\''+leadDivision[k].Division__r.Name+'\'';
                 if(k<leadDivision.size()-1)
                 userDivisionName=userDivisionName+', ';
             }
             division=new String[]{userDivisionName};
  }

 

 WORKING BELOW CODE

==========================================================================

division=new String[] {'Corporate Office','Laboratory Equipment','Scientific Instruments'};

 

i tried a lot for all string manupulations but its not showing me as selected for not working code.

 

I'm trying to generate an Apex class from an external WSDL and am following the steps laid out in the developer docs.

 

I go to my app, click on "Setup", then "Develop", then "Apex Classes", and the next step says to click on the "Generate from WSDL" button, but there is no such button.  What am I doing wrong?  This should just show up by default, right?

 

I have the system administrator role and have pretty much every permission in the book so I'm inclined to think it's not a permission problem... please help!

  • April 20, 2011
  • Like
  • 0

I am trying to create a visualforce email template, and I cannot get the "Body " field to work without getting an error.

 

What is the field name for that field using what I have below for code?

 

 

<apex:repeat value="{!RelatedTo.NotesAndAttachments}" var="NotesAndAttachments">
<tr><td>
Note: {!NotesAndAttachments.Note.Body}</td></tr>
</apex:repeat>

 

  • April 18, 2011
  • Like
  • 0

 

I am trying to add on header checkbox, where I can select All  the row check boxes by clicking on the header

Using the following code.

<apex:column > 

<apex:facet name="header1"><apex:outputLabel value="Select All" for="select_All_Check"/></apex:facet>

<apex:facet name="header2"><apex:inputCheckbox  id="select_All_Check"></apex:inputCheckbox></apex:facet> <apex:inputField id="Selectd_Row" value="{!con.Field__c}" /> 

</apex:column>

It is not displaying both checkbox and text.  is there anything wrong in my code?

 

Thank you.

  • April 15, 2011
  • Like
  • 0

The idea here is function that can get an array of SObjects and collect the ID of the contact shown in the Contact__c custom field. (lookup field).

 

This isn't working:

 

Set<Id> contactIdSet = new Set<Id>();
        for (SObject SObj : SObjArr)
        {
            sobject Temp = SObj.getSObject('Contact__r');
            if (Temp.Id!=null)
                contactIdSet.add(Temp.Id);
        }

 

I tried Temp.get('Id') too, both cause "attempt to de-reference a null" error, which is in my experience the only error I ever get, no matter what the problem.

 

Can anyone advise me?

 

Hi All

 

i need to do some operation on all custom fields of custom objects

 

I am obtaining this object dynamically. So initially i do not know name of my custom, object.

And since i am getting object on the fly hence i do not know the fields

 

Now say if i get object myobject__c. Then i can retrieve all its fields by following code:

 

map<String, Schema.SObjectField> mapFields =  Schema.getGlobalDescribe().get(myobject__c).getDescribe().fields.getMap();

 

My problem is how do i separate standard and custom fields from this collection sothat i can operate only on custom fields.

 

Thanks in advance. Please Help

Let me know if i am not able to explain myself clearly and you need more details

I was hoping one of you bright people could answer a question regarding SOSL and Content.  In the standard Document object, there is a field called IsBodySearchable that allows SOSL to search within the file contents of an uploaded file.  I also know that in the latest release, the ContentVersion object is now searchable with SOSL, and I know that feature was implemented due to this idea in the IdeaExchange which specifically asks for searching file content.  However, I don't see that same field on the ContentVersion object and cannot find any documentation that specifically states that Content file contents can be searched.  I don't want to promise to a client that we can do this programmatically without seeing it in documentation or getting an "official" verification from someone internal to SFDC. Thanks community!

I am using a page which calls on the standard controller for my custom object.

 

I am creating a form and I want to control which form fields show up in column one and column two.

 

Right now every other input field in my page block switchs columns (i.e. Left Col, Then Right Col, Then Left Col)

 

I tried to use a Table calling my custom object but it did not work (perhaps because the custom object represents a single record and not a related list of records)

 

How should I go about this?

Hey all,

I've asked a question similar to this before but I think I can phrase it a little more simply this time. I need to create a trigger that is of course bulk capable that will prevent or rollback any record that causes a rollup field to exceed a value provided. 

 

We use campaigns to track attendance to an event. We have a type of object associated with these events called respondents. We only allow so many different kinds of respondents (males, females, over 18 under 60 etc) to these events. These rules are called quota, we support a maximum of 10 different quota. On the campaign there are fields such as "quota 1 name", "quota 1 required", "quota 1 actual". The "required" is an integer that defines how many of that quota we need, and the "actual" is the rollup that says how many of that kind of person we have recruited.

 

My first thought is just to insert/udpate all the respondents in the trigger data, then query for any campaigns that exceed their quota. Figure out by how much and delete that many respondents that fit that quota. But the problem with that is a person can fit more than one quota, so that doesn't work very well, also it's fairly messy. 

 

The other thought is just grab the current value of the rollup then do the math myself. The really hard part comes with make it bulk safe and dealing with updates/deletes. If i have an incoming list of 100 different respondents, going into 5 different campaigns, I need to break up the list and calculate quota per campaign (which I have working). If it is an insert, I just add 1 to each quota they represent and toss an error if it goes over the set value. But if it's an update I have to remove 1 from every quota they used to represent, then add 1 to the ones they do now. I have a feeling this will be the way I end up going but the complexity scares the Sh** out of me. Thoughts?

Hi,

 

Re: Account Detail

 

I am trying to restrict the user from access to the list of activities shown below when the Account Ownership [change] link is clicked.

 

Transfer open opportunities not owned by the existing account owner
Transfer closed opportunities
Transfer open tickets owned by the existing account owner
Transfer closed tickets
Keep Account Team
Send Notification Email

 

I would like to know how to override this button to provide an alternate destination or alter what the use sees on this screen. 

 

Our Account Page is provided below:

 

<apex:page id="page1" standardController="Account" extensions="IntegratedObjectController" >
<apex:includeScript value="https://ajax.googleapis.com/ajax/libs/jquery/1.5.1/jquery.min.js" />
<script>
var $j = jQuery.noConflict();
$j(function() {
    var saved = InlineEditData.prototype.handleResponse;
    InlineEditData.prototype.handleResponse = function(responseText) {
        saved.apply(this, arguments);
        actionSave();
    };
});

function saved() {
    var errorMessage = $j("#page1\\:form1\\:dynamicOutput").html();
    if (errorMessage.length > 0) {
        alert(errorMessage);
    }
}
</script>
<apex:form id="form1">
    <apex:actionFunction name="actionSave" action="{!actionSave}" oncomplete="saved();"
        rerender="dynamicOutput " />
    <apex:outputPanel id="dynamicOutput" layout="block" style="display:none">
    {!ErrorMessage}
    </apex:outputPanel>
    <apex:detail subject="{!account.Id}" relatedList="true" inlineEdit="true" relatedListHover="true"
        showChatter="true" title="true" />
</apex:form>
</apex:page>

 

I would like to know to modify / override the content in the detail section of this form.

 

Thanks in advance, Dave

 

  • April 13, 2011
  • Like
  • 0

There is a maximum # of statements that you can execute during a single invocation of APEX.

 

Is there any way to programatically determine how close I am to that imit?  I have a recursive procedure that I want to run until it gets close to the limit and then turn itself off before it triggers an unrecoverable error. (you cannot catch that type of error)

 

While I'm at it I wouldn't mind knowing how close I am to running out of heap and levels of nesting.

Stuck with a test method for this trigger and I get the error:

 

Failure Message: "System.AssertException: Assertion Failed: Expected: Open, Actual: O​pen", Failure Stack Trace: "Class.testEventTrigger.test1: line 10, column 5 External entry point"

 

 

Here is the test method:

 

public class testEventTrigger {
  public static testMethod void test1() {
    List<Lead> leads = new List<Lead>{ new Lead(FirstName='Test 1',LastName='Test 1',Status='Open',Company='Test1',Sales_Cycle__c='O​pen'),
                                       new Lead(FirstName='Test 2',LastName='Test 2',Status='Open',Company='Test2',Sales_Cycle__c='O​pen') };
    insert leads;
    List<Event> events = new List<Event>{ new Event(WhoId=Leads[0].Id,Subject='Tour',ActivityDate=System.today(), startdatetime=system.now(), Durationinminutes=60),
                                          new Event(WhoId=Leads[1].Id,Subject='Something Else',ActivityDate=System.today(), startdatetime=system.now(), Durationinminutes=60) };
    insert events;
    Lead[] leadsgo = [select id,Sales_Cycle__c from lead where id in :leads];
    System.assertEquals('Open',Leadsgo[1].Sales_Cycle__c);
    
  }
}

 

 

And the trigger:

 

 

trigger tourchange on Event (before insert) {
  Set<Id> recordIds = new Set<Id>();
  List<Lead> leadsToUpdate = new List<Lead>();

  for(Event t:Trigger.new)
    if(t.subject=='tour' && t.Stages__c <> '30 days' && t.Stages__c <> '60 days')
      recordIds.add(t.whoid);

  leadsToUpdate = [select id from lead where id in :recordIds];

  for(Lead l:leadsToUpdate)
    L.sales_cycle__C = 'Tour Scheduled';

  update leadsToUpdate;
}

 

 

THANKS!

B

Hi,

 

I have a requirement in which I need to instantiate an object (Custom or standard) by the objectName (A String).


for example : If I send the "Account" string as parameter, I want an object (Account object) of this type should be instantiate and get assigned to SObject variable.

 

 

Is there any way we can archive this ?

 

Thanks & Regards,

Anand Agrawal.

I have a requirement to support both English and Thai in my application
I have translated the VF page output text to Thai and it is getting displayed correctly.
But when I render a VF page as PDF, all texts in Thai are not getting displayed.

A snippet of my page is pasted below

 

<apex:page sidebar="false" renderAs="pdf" standardController="Qoute__c" extensions="myControllerExtension" language="th">
<style> body { font-family: Arial Unicode MS; } </style>
<apex:form >
<apex:pageBlock title="Qoute Details">
 
  <apex:panelGrid columns="2"  width="900">
       <apex:image url="{!$Resource.novlogo}" height="100" width="100"/>
      
       <apex:dataList var="r" value="{!qoute}" >
                         
           <apex:panelGrid columns="2" border="1" width="300">  
          <apex:outputLabel value="{!$Label.Customer}"></apex:outputLabel>
               <apex:outputLabel value="{!r.Customer_Name__c}"/>
            <apex:outputLabel value="{!$Label.Product}" lang="th"></apex:outputLabel>

.........etc etc...

In this I have given Thai translation only  for "{!$Label.Product}"  which is not getting displayed


Please help me out ..Its urgent

thanks in advance

  • November 09, 2010
  • Like
  • 0

You have an object with a picklist that contains three values, x, y and z. For testing purposes, you create a record of that object type with a value of "a" in the picklist - Apex allows you to do this. There are already records in the database withvalues of x, y or z in the picklist.

 

You then have a query (after the test has created the record with the "a" value in the picklist) that runs like this:

 

 

Some_Object__c so = [select ID from Some_Object__c order by Your_Picklist_field__c asc nulls last limit 1];

 

 

Which record is returned from the database? The one with "a"? No - for some reason this is the last record returned by the query.

 

Can anyone else confirm this, and if there's anything obvious I'm missing to get what I think should be the expected result - the value inserted by the test is the returned record?

  • October 29, 2010
  • Like
  • 0

Hi,

 

I have a question in regards with governors and limits:

 

Within a trigger we can have 20 soql queries limit.

 

 assume that we have a scenario where we have a Before trigger and After Trigger on an object. What is the number of SOQL query limits on both the trigger. Do they both share same limit ot 20 or would it be double(40)?.

 

Thanks,

Sales4ce

The #2 All Time Apex/VF idea on the idea exchange is something we're evaluating currently (#1 is scheduled for delivery this summer).

 

There are some descriptions of what people want to do there but I'd like to get more detailed input from the community.   What level of integration would you expect with the surrounding Visualforce page/controller?

 

Please read through the comments and add any use cases description and answer to the above question there. And if you haven't voted already, please do ;-)

 

Thanks,

If I'm building something and have a question about chatter should I log it on this board or in the chatter dev zone?
Message Edited by mtbclimber on 03-17-2010 03:44 PM

I received an email with the following inquiry:

 

Is there an easy way to determine the underlying SObject type when using objects that store polymorphic keys e.g. ProcessInstance? I tried the following :
 
for(ProcessInstance inst: [Select TargetObject.Id, Status, Id From ProcessInstance]){
                SObject sObj = inst.TargetObject;
                System.debug('>>>>>>>>>>>>>>>>>>>>>'+(sObj.getSObjectType()));
}
 
And I get this:
18.0 APEX_CODE,DEBUG;APEX_PROFILING,INFO;CALLOUT,INFO;DB,INFO;VALIDATION,INFO;WORKFLOW,INFO
8:6:22.566|EXECUTION_STARTED
8:6:22.566|CODE_UNIT_STARTED|[EXTERNAL]System Log Window
8:6:22.569|SOQL_EXECUTE_BEGIN|[1,27]|Aggregations:0|Select TargetObject.Id, Status, Id From ProcessInstance
8:6:22.574|SOQL_EXECUTE_END|[1,27]|Rows:4|Duration:5
8:6:22.574|METHOD_ENTRY|[3,1]|System.debug(String)
8:6:22.574|METHOD_ENTRY|[3,39]|SObject.getSObjectType()
8:6:22.574|METHOD_EXIT|[3,39]|getSObjectType()
8:6:22.574|USER_DEBUG|[3,1]|DEBUG|>>>>>>>>>>>>>>>>>>>>>Name
8:6:22.574|METHOD_EXIT|[3,1]|debug(ANY)
 
Do I have to use the "Id" prefix to determine what Object the record is associated with?

 

 

And the answer to this is that yes using the ID prefix is one way to do this but an easier one is to recognize that polymorphic relationships like  ProcessInstance.TargetObject and Event/Task.who/what point to the Name object. The name object has a convenient "Type" field which provides the sobject type information. So simply adding that field to the above query should provide the information required in this inquiry:

 

 

 

for(ProcessInstance inst: [Select TargetObject.Id, TargetObject.type, Status, Id From ProcessInstance]){
SObject sObj = inst.TargetObject;
System.debug('>>>>>>>>>>>>>>>>>>>>>'+(sObj.getSObjectType()));

System.debug('The Type for id: ' + sObj.id + ' is: ' + sObj.type);
}

 

Message Edited by mtbclimber on 03-08-2010 08:29 AM

I'm trying to access a junction object on Contact. This object is to build a many-to-many relationship between Contact and Holiday__c. I drill down into each Account to display info from Opportunity and Contact. I can get to all the data except the junction object on a Visualforce page. My junction object is ContactHolidayAssociations__c

I get this error:

Save error: SOQL statements cannot query aggregate relationships more than 1 level away from the root entity object. 

 

accounts = [select name, owner.name,
(select FirstName, LastName, Id, (Select Id, Name, Holiday__r.Holiday_Name__c From ContactHolidayAssociations__r) from Contacts), 
(select Name from Opportunities) from Account ];

 

 

Can someone suggest a way around this?

 

Thanks.

  • December 12, 2013
  • Like
  • 0

I am a programming-illiterate admin who recently hired a free-lance programmer to write a simple trigger for our org and provide directions for deployment. He finished the job, and now directed me to write the test class prior to deployment. I had a look at the instructions and its Greek to me. He now offered to do it for me, at an extra cost. Does it make sense that this would not be considered a natural part of the trigger development and would require an extra cost?

Hello!

 

I have a trigger on Opportunity who is working pretty well!
But my user have to press F5 (refresh) to see the Opportunity line item updated on the opportunity page.

 

Does any way exist to update the opportunity page after the (after insert) trigger.

 

Note: 

My trigger has a Future annotation 

 

 

Thanks

 

  • October 05, 2012
  • Like
  • 0

helloo

 

how much should be Trigger Code Coverage  in order to deploy to production or to do a package ?

 

thanks in advance

 

sam

 

 

  • October 05, 2012
  • Like
  • 0

Hi All,

I want to create a Favorites field for Opportunities object where a user can mark any opportunities as favorite and then view all his favorites by creating a new view called My Favorites. The favorites will be restricted across users. Please help to accomplish this feature. Do I need to create a field or can this be achieved by any alternate way? 

How can i fetch record id of object in visualforcepage controller?

  • October 04, 2012
  • Like
  • 0

Controller:

public class reqfields {

Registration__c c=new Registration__c();
Public ID idd {get; set;}
public Attachment attachment {
get {
if (attachment == null)
attachment = new Attachment();
return attachment;
}
set;
}
 public PageReference Save(){
insert c;
idd=c.id;
Attachment a = new Attachment(parentid = idd, name=attachment.name, body = attachment.body);
insert a;
return new ApexPages.StandardController(c).view();
}
public reqfields(ApexPages.StandardController Controller) {

}

}

 

Dont mind, I'm unable to provide in nice format...

 

but Plz let me know how to save the record along with the uploaded document.

 

Note: Record id is saving in custom field Name.

  • September 24, 2012
  • Like
  • 0

OK, I have made extensive research on StandardSetController before implementing quite a complex page with features not supported by <apex:listView> or <apex:enhancedList>.

 

I have implemented pagination and column ordering, as well as some client-side multi-line selection and actions.

 

I have implemented dynamic read/write or readonly control line by line, depending on the Approved status of each line.

 

On this path, I have encountered the bug setting page size :

http://boards.developerforce.com/t5/Visualforce-Development/StandardSetController-setPageSize-does-not-work/td-p/202018

or here

http://boards.developerforce.com/t5/Visualforce-Development/bug-StandardSetController-or-QueryLocator-ignores-SOQL-where/td-p/99500

so I do not change page size.

 

 

I have another problem, and think I have the solution.

My StandardSetController is on a Parent/Children page, so filtered (by a where clause) to the id of the parent :

SELECT ID Rep__c STATUS_Done__c, isReadWrite__c, LastModifiedDate
FROM   CE_Line__c
WHERE  Rep__c = :repid

 

When I apply a filter in my VF page like this

<apex:panelGroup id="listViewFilterGrp">
    <apex:outputLabel value="Filter: "/>
    <apex:selectList value="{!CELines.filterID}" size="1">
        <apex:actionSupport event="onchange" action="{!updateMyLines}" rerender="table"/>
        <apex:selectOptions value="{!CELines.ListViewOptions}"/>
    </apex:selectList>
</apex:panelGroup>

and apply a filter, the 'WHERE Rep__c = : cerepid' clause gets wiped out : the returned list is filtered according to the definition of the filter, but across all RepIds !

 

Now I have spotted this person's problem with a WHERE clause being added to their Database query when filtering :

http://boards.developerforce.com/t5/Apex-Code-Development/ERROR-at-Row-1-Column-132-unexpected-token-WHERE/td-p/118177

 

This actually shows that the filter simply removes your own WHERE clause and *replaces* it with the equivalent clause from the filter.  How silly !!!  The filter clause should be *added* to my existing clause with AND, and everything would be fine.

 

Salesforce, please fix this bug to make StandardSetController filtering work on a Parent/Children page.

 

Thanks,

Rup

 

Hi,

 

i have a vf page for contacts and in the top section of the page i.e contact information in that all the fields are not available for all the profiles so it should just leave a blank space for the fileds wich do not have permission but whats happening is its changing the fileds placement from left to right can any one help with this.

<apex:page tabStyle="contact" standardController="Contact" extensions="ContactDetailExtensionController">

<apex:form id="contactForm">

<apex:pageBlock title="{!$Label.conDetail_ContactDetail}" mode="maindetail">
<apex:pageBlockButtons >
                    <apex:commandButton value="{!$Label.conDetail_Edit}" action="{!edit}" />
                    <apex:commandButton value="{!$Label.conDetail_Delete}" action="{!delete}" />
                    <apex:commandButton value="{!$Label.conDetail_ContactHistoryRpt}" onclick="window.open('/00O30000003gp3O?pv0={!Contact.Id}','ContactHistoryReport','width=800,height=600,scrollbars=yes')" />
                    <!-- <apex:commandButton value="Clone" action="{!clone}" rendered="{!checkLevel2or3SysAdmin}" /> -->
</apex:pageBlockButtons>
<apex:outputPanel >
<apex:pageBlockSection collapsible="true" title="{!$Label.conDetail_ContactInfo}" showHeader="true">
    <apex:pageBlockSectionItem >
   
        <apex:outputLabel value="{!$Label.conDetail_ContactName}" for="theContactName"/>
        <apex:outputField value="{!contact.name}" id="theContactName"/> 
       
    </apex:pageBlockSectionItem>
      <apex:outputField value="{!contact.phone}" rendered="{!accessContactContactInformation}"/>
      <apex:pageBlockSectionItem >
     
      <apex:outputLabel value="{!$Label.conDetail_AltContactName}" for="theContactAlternateName"/>
      <apex:outputtext id="theContactAlternateName" Value="{!contact.Alternate_First_Name__c} {!contact.Alternate_Last_Name__c}"/> 
   
    </apex:pageBlockSectionItem>
  
      <apex:outputField value="{!contact.mobilephone}" rendered="{!accessContactContactInformation}"/>
      <apex:outputText value="" rendered="{!accessContactContactInformation==false}"/>    
     
     
      <apex:outputField value="{!contact.accountId}"/>     
      <apex:outputText value="" rendered="{!accessContactContactInformation==false}"/>  
   
      <apex:outputField value="{!contact.email}" rendered="{!accessContactContactInformation}"/>
      <apex:outputField value="{!contact.title}"/>  
      <apex:outputField value="{!contact.Secondary_Email__c}" rendered="{!accessContactContactInformation}"/>
      <apex:outputText value="" rendered="{!accessContactContactInformation==false}"/>
      <apex:outputField value="{!contact.Management_Level__c}" /> 
      <apex:outputField value="{!contact.fax}" rendered="{!accessContactContactInformation}"/>
      <apex:outputField value="{!contact.Functional_Area__c}"/>  
      <apex:outputField value="{!contact.Critical_Contact__c}"/> 
      <apex:outputText value="" rendered="{!accessContactContactInformation==false}"/>
      <apex:outputField value="{!contact.department}"/>
      <apex:outputField value="{!contact.Contact_Status__c}"/>  
      <apex:outputField value="{!contact.reportsToId}">
      <apex:commandLink action="{!ViewOrgChart}" value="[{!$Label.conDetail_ViewOrgChart}]"/> </apex:outputField>
      <apex:outputField value="{!contact.LeadSource}"/> 
      <apex:outputText value=""/>
      <apex:outputField value="{!contact.Days_Since_Last__c}"/>
      <apex:outputField value="{!contact.accountId}" rendered="false"/>    
      <apex:outputField value="{!contact.mailingStreet}" rendered="false"/>
      <apex:outputField value="{!contact.mailingCity}" rendered="false"/>
      <apex:outputField value="{!contact.mailingState}" rendered="false"/>
      <apex:outputField value="{!contact.mailingPostalCode}" rendered="false"/>
      <apex:outputField value="{!contact.mailingCountry}" rendered="false"/>
      <apex:outputField value="{!contact.otherStreet}" rendered="false"/>
      <apex:outputField value="{!contact.otherCity}" rendered="false"/>
      <apex:outputField value="{!contact.otherState}" rendered="false"/>
      <apex:outputField value="{!contact.otherPostalCode}" rendered="false"/>
      <apex:outputField value="{!contact.otherCountry}" rendered="false"/>
   
</apex:pageBlockSection>
</apex:outputPanel>
</apex:pageblock>
</apex:page>

 basically whether i give values or not , whether the profile has permission or not the fileds placement should not change.

Thanks

Akhil

  • December 01, 2011
  • Like
  • 0

Is it common to use Visualforce to over the challenge of Last Name being required in Leads?

 

I have a client that uses company names not people, and needs a work around from having to always enter name

  • November 22, 2011
  • Like
  • 0

Hello All,

 

So I have a nice read only page that gets tons of records from the controller. The trouble is, when I write a unit test for the controller it fails because I get more than 50k records!

 

Any suggestions?

 

Thanks!

I have one custom object which has look up relationship on account. I have created fieldset on Custom object and added releted fields on account object. At the time of accessing the fieldset on VF page, i am getting an error.

 

Unknown property '$ObjectType.CustomObjectName.fields.Account__r'

Error is in expression '{!$ObjectType.CustomObjectName.Fields[f].localname}' in component <apex:repeat> in page condition
Error evaluating dynamic reference 'Account__r.Type'
So is it possible to access related object fields using fieldset?

Thanks in advance



 

 

  • September 20, 2011
  • Like
  • 0

One for the admins.

 

By changing the class declaration of my page controllers (with/without sharing) I can give my classes access to standard objects that customer portal users shouldn't have access to. I'd like to know if this is a security hole and if I'm in danger of it being closed as that would mean vastly changing the user experience for my 1.7 million portal users.

 

Wes

I am running a query on the Event object, and it's working until I tried grabbing a custom field on the User who is assigned (the Owner).  I already had standard fields pulling from the Owner, so not sure why it's not working for the custom field.  I pulled my naming from the schema browser a few different times, just to be sure...

 

Here's my query:

 

tempAppts = [SELECT WhoId, WhatId, OwnerId, Owner.FirstName, Owner.Profile__c, Owner.Name, Subject, StartDateTime, Result__c
	FROM Event
	WHERE WhoId = :contactID
	AND StartDateTime >= :yaynow
	AND Result__c != 'Rescheduled'];

OwnerId, Owner.FirstName, and Owner.Name work fine, but once I put in Owner.Profile__c I get an error on save.  I have tried OwnerId.Profile__c, Owner__r.Profile__c, etc.  The error message is strange as well, references "Name" instead of "Owner":

 


Save error: No such column 'Profile__c' on entity 'Name'. If you are attempting to use a custom field, be sure to append the '__c' after the custom field name. Please reference your WSDL or the describe call for the appropriate names.

 

 

  • March 09, 2011
  • Like
  • 0

Is there a way to query for a particular user's "Recent Items" list?

 

That is, I want to be able to fetch a list of the last several records of a particular object that a particular user has viewed.

 

Thanks

Hi

 

can't seem to find an answer to this one anywhere !

 

Can i use select to SOQL picklist values ? If as I suspect the answer is 'no' what is the standard way to do this.

 

ta in advance

I have a field that has text in it that I am outputting to a PDF using visualforce and the text is wrapping and not holding the CR formatting.  Any suggestions on how to keep the formatting of the text when displayed in visualforce?

 

Thanks,
Terry

Hello,

 

I have a custom VF page and controller. The controller is declared as 

 

 

public with sharing class MyCustomController {

The user accessing this page is a Partner user and does not have "Edit" Permissions on Leads but is still able to assign leads to other users.

 

I also tried assigning leads to a user who does not have "Read" permission on leads and that also surprising worked.

 

As per my understanding if I declare the class with the "with sharing" keyword, it should take into account the user permission.

 

Can someone explain why the "with sharing" is not having any effect.

 

Thanks,

Rohit