• mtbclimber
  • PRO
  • 3051 Points
  • Member since 2003

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

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.

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

 

helloo

 

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

 

thanks in advance

 

sam

 

 

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?

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.

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

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

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



 

 

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.

 

 

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