• jwolf
  • NEWBIE
  • 0 Points
  • Member since 2008

  • Chatter
    Feed
  • 0
    Best Answers
  • 1
    Likes Received
  • 0
    Likes Given
  • 8
    Questions
  • 18
    Replies

With the latest update to the API in version 24, the default view of data in tests is to not be able to see all data, without explicitly using an annotation. Obviously that's good for testing practices, but it definitely gets in the way of how Salesforce does not allow for the creation of standard pricebooks.

 

The use case is as follows:

 

When creating pricebook entries for a custom pricebook, a standard entry for each custom entry must be created first.

In order to create a standard entry, we would need to find a standard pricebook.

Since we can't see all data, we can never retrieve the standard pricebook that exists in the org, nor can we just create a new standard pricebook to use.

 

Has anyone found a way around this without using the SeeAllData annotation?

  • March 15, 2012
  • Like
  • 0

I'm trying to connect to a soap web service which implicitly defines a required soap header. That part of the WSDL looks like this:
 <s0:Policy s1:Id="Auth.xml">
    <wssp:Identity xmlns:wssp="http://www.bea.com/wls90/security/policy">
      <wssp:SupportedTokens>
        </wssp:SecurityToken>
      </wssp:SupportedTokens>
    </wssp:Identity>
  </s0:Policy>
  <wsp:UsingPolicy s2:Required="true"/>
In order to call this service, I need to set my soap header to look like this:
<soapenv:Header>
<wsse:UsernameToken wsu:Id="UsernameToken-3" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
<wsse:Username>someusername</wsse:Username>
</wsse:UsernameToken>
</wsse:Security>
</soapenv:Header>
So, wsdl2apex doesn't create these elements when generating the apex class. As far as I can see its not possible to set arbitrary soap headers from within apex. At this point I've tried to modify the WSDL to make this explicit and I've tried to modify the generated class to produce the proper header but I've had no luck up to this point. Anyone have any ideas? Is this possible from within apex?

  • September 13, 2010
  • Like
  • 0

How is field on UserRole ParentRoleId different than any other reference field? I want to make a query to get the name of the parent role, but I get an error that this relationship is not recognized. The query I want to make is this:

 

[select Name, ParentRoleId, ParentRole.Name from UserRole where Id = :someId]

 

 

Is this possible?

  • August 31, 2010
  • Like
  • 0

I have a visual force page that creates and updates related records. Recently these records have started to show up under 'Recent Items' in the sidebar. Is this expected behavior? I've never seen this happen before.

  • May 27, 2010
  • Like
  • 0
Execute Anonymous in v16 of the Force.com IDE has stopped working. For any valid code that I enter the only output I receive is 'Anonymous execution was successful.' No records are actually modified, and no debug logs are shown.
  • February 01, 2010
  • Like
  • 0
I am trying to send an email with Apex using a visualforce page as the html body of the email by using PageReference.getContent(); However, when I call getContent() it is rendering the page without the one repeat component. I know that the collection the repeat is iterating over has data because if I redirect to the same PageReference the repeat component gets rendered as expected. The apex code looks like this:
 

PageReference emailTemplate = Page.ProjectInvoiceTrackingEmailTemplate;Blob emailBody = emailTemplate.getContent();System.debug(emailBody.toString());

 the template looks like this:

 

<apex:page id="templatePage" sidebar="false" showHeader="false" controller="ProjectInvoiceEmailController"> <h1>Template header</h1> <apex:repeat value="{!actualProjectsToNotify}" var="project" rendered="true"> <apex:outputText value="{!project.projectName}" /> </apex:repeat> <h3>page end</h3></apex:page>

Does anyone have any ideas why this wouldn't be rendered when calling getContent(), but it is rendered when that same page reference is rendered in the browser? 

 

 

 
  • May 20, 2009
  • Like
  • 1
What is the best way to test methods annotated with @future? I have one such method that updates account records, but I am unable to write any meaningful tests, because I can't wait until it is finished executing to test the updated rows. Does anyone have any suggesstions?
  • January 27, 2009
  • Like
  • 0
I'm having trouble figuring out the expected behavior of my SOSL queries. Could someone give an example or point me to where I could find a more exact specification for SOSL queries other than the page at http://www.salesforce.com/us/developer/docs/api/Content/sforce_api_calls_sosl_find.htm.

Here is an example what I mean:

This is the record I am trying to retrieve:

Solution{SolutionNote=You will need to check either View All Data or Manage Public Reports to allow more visibility., IsPublishedInPublicKb=true, SolutionName=Reports}

This query returns the record as expected

[FIND '*public*' IN ALL FIELDS RETURNING Solution (SolutionNote, SolutionName)]

however the search term '*either*' returns nothing

but the term 'either' returns the record

So, basically in what cases is the '*' match 0 or more characters, and when does it match at least 1?
  • December 16, 2008
  • Like
  • 0
I am trying to send an email with Apex using a visualforce page as the html body of the email by using PageReference.getContent(); However, when I call getContent() it is rendering the page without the one repeat component. I know that the collection the repeat is iterating over has data because if I redirect to the same PageReference the repeat component gets rendered as expected. The apex code looks like this:
 

PageReference emailTemplate = Page.ProjectInvoiceTrackingEmailTemplate;Blob emailBody = emailTemplate.getContent();System.debug(emailBody.toString());

 the template looks like this:

 

<apex:page id="templatePage" sidebar="false" showHeader="false" controller="ProjectInvoiceEmailController"> <h1>Template header</h1> <apex:repeat value="{!actualProjectsToNotify}" var="project" rendered="true"> <apex:outputText value="{!project.projectName}" /> </apex:repeat> <h3>page end</h3></apex:page>

Does anyone have any ideas why this wouldn't be rendered when calling getContent(), but it is rendered when that same page reference is rendered in the browser? 

 

 

 
  • May 20, 2009
  • Like
  • 1

With the latest update to the API in version 24, the default view of data in tests is to not be able to see all data, without explicitly using an annotation. Obviously that's good for testing practices, but it definitely gets in the way of how Salesforce does not allow for the creation of standard pricebooks.

 

The use case is as follows:

 

When creating pricebook entries for a custom pricebook, a standard entry for each custom entry must be created first.

In order to create a standard entry, we would need to find a standard pricebook.

Since we can't see all data, we can never retrieve the standard pricebook that exists in the org, nor can we just create a new standard pricebook to use.

 

Has anyone found a way around this without using the SeeAllData annotation?

  • March 15, 2012
  • Like
  • 0

Does anyone know if it will be possible to add Database.com licenses (for standard users, light users, records and transactions) to a Force.com EE org? Or, the reverse (add Force.com licenses to a Database.com org).

 

I'm considering using Database.com as the "back end" for a customer-facing app (built on rails). But, I'd like to leverage Force.com features (i.e., form builder, reports, etc.) to view the data from an internal perspective. And, I'll probably bump up from Force.com EE licenses, to CRM EE licenses at some point (to manage opportunities, marketing campaigns, cases, etc.). Basically, I want to know if this can all happen in a single org.

 

I would assume that I could start with Database.com and then "upgrade" by adding Force.com/CRM licenses, but I've seen no actual documentation that states this. Does anyone have any insight?

I have an old application that uses Web-To-Lead. I'm updating it to use the REST API. We have a bunch of assignment rules set up for Leads. When we create a lead through Web-To-Lead, the Lead is assigned according to our assignment rules. However, when we create a Lead through the REST API, the assignment rules are completely ignored, and the Lead is assigned to the account whose credentials we used to authenticate through OAuth. This has slowed our sales team to a crawl, because now they have to assign leads by hand.

 

Any ideas how to fix this?

It was working fine before but the date fields stopped showing the nice popup calendar on sites now..!!!!!!!!!!!!!!!!!! please help???!!!

I'm trying to connect to a soap web service which implicitly defines a required soap header. That part of the WSDL looks like this:
 <s0:Policy s1:Id="Auth.xml">
    <wssp:Identity xmlns:wssp="http://www.bea.com/wls90/security/policy">
      <wssp:SupportedTokens>
        </wssp:SecurityToken>
      </wssp:SupportedTokens>
    </wssp:Identity>
  </s0:Policy>
  <wsp:UsingPolicy s2:Required="true"/>
In order to call this service, I need to set my soap header to look like this:
<soapenv:Header>
<wsse:UsernameToken wsu:Id="UsernameToken-3" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
<wsse:Username>someusername</wsse:Username>
</wsse:UsernameToken>
</wsse:Security>
</soapenv:Header>
So, wsdl2apex doesn't create these elements when generating the apex class. As far as I can see its not possible to set arbitrary soap headers from within apex. At this point I've tried to modify the WSDL to make this explicit and I've tried to modify the generated class to produce the proper header but I've had no luck up to this point. Anyone have any ideas? Is this possible from within apex?

  • September 13, 2010
  • Like
  • 0

Hi,

 

My webservice expects the security header to have username, password, password type and timestamp.

I am stuck with an issue and would like some assistance.

 

My Webservice code is

    public static void setupSecurity(Object service) {

        org.apache.cxf.endpoint.Client client = org.apache.cxf.frontend.ClientProxy.getClient(service);

        org.apache.cxf.endpoint.Endpoint cxfEndpoint = client.getEndpoint();

        Map<String, Object> outProps= new HashMap<String, Object>();

        outProps.put(WSHandlerConstants.ACTION,

                WSHandlerConstants.USERNAME_TOKEN + ' ' + WSHandlerConstants.TIMESTAMP);

        outProps.put(WSHandlerConstants.PASSWORD_TYPE, WSConstants.PW_TEXT);

        outProps.put(WSHandlerConstants.PW_CALLBACK_CLASS, ClientPasswordHandler.class.getName());

        outProps.put(WSHandlerConstants.USER, "Admin");

        PhaseInterceptor<SoapMessage> wssOut = new WSS4JOutInterceptor(outProps);

        cxfEndpoint.getOutInterceptors().add(wssOut);

        cxfEndpoint.getOutInterceptors().add(new SAAJOutInterceptor());

    }

 

As PasswordType also has to be sent as part of SOAP header i updated the WSDL.

Below is partial WSDL

 <xsd:schema elementFormDefault="qualified" targetNamespace="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" >
     <xsd:element name="Security" type="s3:SecurityHeaderType"/>
       <xsd:complexType name="SecurityHeaderType">
        <xsd:sequence>
          <xsd:element minOccurs="1" maxOccurs="1" name="UsernameToken" type="s3:UsernameToken"/>
          <xsd:element minOccurs="1" maxOccurs="1" name="TimeStamp" type="s3:TimeStamp"/>
        </xsd:sequence>
      </xsd:complexType>
      <xsd:complexType name="UsernameToken">
        <xsd:sequence>
          <xsd:element minOccurs="0" maxOccurs="1" name="Username" type="xsd:string"/>
          <xsd:element  minOccurs="1" maxOccurs="1" name="Password">
           <xsd:complexType>
             <xsd:simpleContent>
                 <xsd:extension base="xsd:string">
                       <xsd:attribute name="Type" type="xsd:string"/>
                     </xsd:extension>
              </xsd:simpleContent>
          </xsd:complexType>
           </xsd:element>         
         </xsd:sequence>
      </xsd:complexType>
    
      <xsd:complexType name="TimeStamp">
        <xsd:sequence>
          <xsd:element minOccurs="0" maxOccurs="1" name="Created" type="xsd:dateTime"/>
          <xsd:element minOccurs="0" maxOccurs="1" name="Expires" type="xsd:dateTime"/>
        </xsd:sequence>
      </xsd:complexType>

    </xsd:schema>

 

I added attribute Type for the Password element in WSDL. The Webservice is using PasswordText as the type.

 

Below is the generated code of the security class

public class OasisSecurity {
    public class Password_element {
        public String Type_x;
        private String[] Type_x_att_info = new String[]{'Type'};
        private String[] apex_schema_type_info = new String[]{'http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd','true','false'};
        private String[] field_order_type_info = new String[]{};
    }
    public class TimeStamp {
        public DateTime Created;
        public DateTime Expires;
        private String[] Created_type_info = new String[]{'Created','http://www.w3.org/2001/XMLSchema','dateTime','0','1','false'};
        private String[] Expires_type_info = new String[]{'Expires','http://www.w3.org/2001/XMLSchema','dateTime','0','1','false'};
        private String[] apex_schema_type_info = new String[]{'http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd','true','false'};
        private String[] field_order_type_info = new String[]{'Created','Expires'};
    }
    public class UsernameToken {
        public String Username;
        public OasisSecurity.Password_element Password;
        private String[] Username_type_info = new String[]{'Username','http://www.w3.org/2001/XMLSchema','string','0','1','false'};
        private String[] Password_type_info = new String[]{'Password','http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd','Password_element','1','1','false'};
        private String[] apex_schema_type_info = new String[]{'http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd','true','false'};
        private String[] field_order_type_info = new String[]{'Username','Password'};
    }
    public class SecurityHeaderType {
        public OasisSecurity.UsernameToken UsernameToken;
        public OasisSecurity.TimeStamp TimeStamp;
        private String[] UsernameToken_type_info = new String[]{'UsernameToken','http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd','UsernameToken','1','1','false'};
        private String[] TimeStamp_type_info = new String[]{'TimeStamp','http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd','TimeStamp','1','1','false'};
        private String[] apex_schema_type_info = new String[]{'http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd','true','false'};
        private String[] field_order_type_info = new String[]{'UsernameToken','TimeStamp'};
    }
}

 

The problem i am facing is, i am able to assign value to the Type_x of the Password_element class.

But i am unable to set the value to the Password .

 

This is how the header part of my request looks like

<?xml version="1.0" encoding="UTF-8"?><env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><env:Header><Security xmlns="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"><UsernameToken><Username>Administrator</Username><Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText" /></UsernameToken><TimeStamp><Created>2010-07-28T17:42:25.966Z</Created><Expires>2010-11-25T17:42:25.966Z</Expires></TimeStamp></Security></env:Header>

 And it can be seen in header that i am just able to pass the attribute Type of Password tag and unable to set Value for Password.

 

I am getting the below error message after the webservice callout.

System.CalloutException: Web service callout failed: WebService returned a SOAP Fault: Fault occurred while processing. faultcode=ns1:client faultactor=

 

Any help on this will be highly appreciated.

I believe that there is a bug associated with custom settings.

I used the migration tool to create custom settings in an org I use for integration. Test methods that reference the custom setting get a null value when I attemp to retrieve the custom setting.
After I went into the org and manually set a value in the custom setting (it is a public hierarchy) and then removed the value, subsequent executions of the test code executed as expected and the retrieval of the custom setting result in a non-null result.

I am concerned that I have to manually make a change to the custom setting before it is visible to the apex code. 
  • February 13, 2010
  • Like
  • 0

Hi How do I get around this error message...

Collection size 1,609 exceeds maximum size of 1,000.

 

 

public String cname{get; set;} public List<SelectOption> getnames() { List<SelectOption> options = new List<SelectOption>(); List<Contact> namelist = new List<Contact>(); namelist = [Select Id, Name FROM Contact where Recordtype.name='Company' Order by LastName,FirstName]; options.add(new SelectOption('--None--','--None--')); for (Integer j=0;j<namelist.size();j++) { options.add(new SelectOption(namelist[j].Name,namelist[j].Name)); } return options; }

 

 

<td> <apex:outputlabel value="Company Names" for="cnamed" /> <apex:selectList value="{!cname}" size="1" id="cnamed"> <apex:actionSupport event="onchange" reRender="newvalue" /> <apex:selectOptions value="{!names}"/> </apex:selectList> </td>

 Thank you

 

 

I have a visual force page that was created in Summer 10 in my FCS to update cases.

 

The page allowed the user to change the case status and also create an entry into a customer object and create a case comment all from the same page.

 

It was working perfect in until today.  the only change was my Sandbox was updated to Spring 10.

 

Now whenever I try to update the case from the Visual Force Page I get the following error:

 

System.DmlException: Update failed. First exception on row 0 with id 50030000005o8ETAAY; first error: FIELD_INTEGRITY_EXCEPTION, No selected contact: [ContactId]

 

If I edit the case from GUI I do not get the error.  If I select a contact (Which is not a required field) and then execute the visual force page ot works fine.

 

What has chnaged in Spring 10 that is causing this to happen.

 

Any help is apprciated.

 

 

Here is the page:

 

 

<apex:page Controller="newEnhancemnetController" tabStyle="Case" id="thePage"> <script> function confirmCancel() { var isCancel = confirm("Are you sure you wish to cancel?"); if (isCancel) return true; return false; } </script> <apex:sectionHeader title="New Enhancemnet Approval" subtitle="for change board Case"/> <apex:form > <apex:pageBlock mode="edit"> <apex:pageMessages ></apex:pageMessages> <apex:pageBlockButtons > <apex:commandButton action="{!Save}" value="Save"/> <apex:commandButton action="{!Cancel}" value="Cancel" onclick="return confirmCancel()" immediate="true"/> </apex:pageBlockButtons> <apex:pageBlockSection title="Change Current Case Status" columns="1"> <apex:outputField value="{!Case.id}"/> <apex:outputField value="{!Case.subject}"/> <apex:outputField value="{!Case.description}"/> <apex:pageBlockSectionItem > <apex:outputLabel value="{!$ObjectType.Case.fields.Status.label}" for="casestatus" style="font-weight:bold"/> <apex:outputPanel styleClass="requiredInput" layout="block"> <apex:outputPanel styleClass="requiredBlock" layout="block"/> <apex:selectList value="{!casestatus}" id="casestatus" size="1" title="Status" required="true"> <apex:selectOptions value="{!items}"/> </apex:selectList> </apex:outputPanel> </apex:pageBlockSectionItem> </apex:pageBlockSection> <apex:pageBlockSection title="Add Enhancement Approval Information" columns="2"> <apex:inputField id="eaAprovedFor" value="{!EnhancementApproval.Approved_For__c}" required="true"/> <apex:inputField id="eaEnvironment" value="{!EnhancementApproval.Environment__c}" required="true"/> <apex:inputField id="eaValidFrom" value="{!EnhancementApproval.Valid_From__c}" required="true"/> <apex:inputField id="eaOtherQCS" value="{!EnhancementApproval.Other_QCS__c}" required="False"/> <apex:inputField id="eaValidTo" value="{!EnhancementApproval.Valid_To__c}" required="true"/> </apex:pageBlockSection> <apex:pageBlockSection title="Add a Case Comment"> <apex:inputField id="caseComment" value="{!CaseComment.CommentBody}"/> </apex:pageBlockSection> </apex:pageBlock> </apex:form> </apex:page>

 

 Here is the controller:

 

 

public class newEnhancemnetController { String casestatus; Case oCase; Enhancement_Approval__c oEnahncemnetApproval; Contact contact; CaseComment casecomment; Map<String,String> mCaseStatus = new Map<String,String>(); public Case getCase() { oCase = [select id, subject, status, description from Case where id = :ApexPages.currentPage().getParameters().get('id')]; if(oCase== null) oCase= new Case(); return oCase; } public Contact getContact() { if(contact== null) contact= new Contact(); return contact; } public String getCaseStatus() { if(casestatus==null){casestatus=oCase.Status;} return casestatus ; } public void setCaseStatus(String casestatus ) { this.casestatus = casestatus ; } public List<SelectOption> getItems() { mCaseStatus.Put('New','New'); mCaseStatus.Put('Approved for Analysis & Design','Approved for Analysis & Design'); mCaseStatus.Put('Reqmts/A&D In Progress','Reqmts/A&D In Progress'); mCaseStatus.Put('Reqmts/A&D Completed','Reqmts/A&D Completed'); mCaseStatus.Put('Approved for Sandbox Build/Config/Test','Approved for Sandbox Build/Config/Test'); mCaseStatus.Put('Sandbox Build In Progress','Sandbox Build In Progress'); mCaseStatus.Put('Sandbox Testing Failed','Sandbox Testing Failed'); mCaseStatus.Put('Sandbox Testing Passed','Sandbox Testing Passed'); mCaseStatus.Put('Waiting for Production Release Date','Waiting for Production Release Date'); mCaseStatus.Put('Release Date Assigned/Approved for Prod','Release Date Assigned/Approved for Prod'); mCaseStatus.Put('Production Testing Failed','Production Testing Failed'); mCaseStatus.Put('Production Testing Passed','Production Testing Passed'); mCaseStatus.Put('On Hold / No Activity','On Hold / No Activity'); mCaseStatus.Put('On Hold / Lack of Funding','On Hold / Lack of Funding'); //mCaseStatus.Put('',''); List<SelectOption> options = new List<SelectOption>(); Schema.DescribeFieldResult fieldResult = Schema.sObjectType.Case.Fields.Status; fieldResult = fieldResult.getSObjectField().getDescribe(); List<Schema.PicklistEntry> ple = fieldResult.getPicklistValues(); for( Schema.PicklistEntry f : ple) { if (mCaseStatus.containskey(f.getValue())) options.add(new SelectOption(f.getLabel(), f.getValue())); //options.add(new SelectOption(f.getLabel(), f.getValue())); } return options; } //public List<SelectOption> getItems() { // List<SelectOption> options = new List<SelectOption>(); // for (CaseStatus cs : [Select MasterLabel from CaseStatus order by sortorder]){ // options.add(new SelectOption(cs.MasterLabel,cs.MasterLabel)); // } // return options; //} public CaseComment getCaseComment () { if(casecomment== null) casecomment= new CaseComment(); return casecomment; } public Enhancement_Approval__c getEnhancementApproval() { if(oEnahncemnetApproval== null) oEnahncemnetApproval= new Enhancement_Approval__c(); return oEnahncemnetApproval; } public PageReference cancel() { PageReference casePage = new ApexPages.StandardController(oCase).view(); casePage .setRedirect(true); return casePage ; } public PageReference Save() { if (oEnahncemnetApproval.Environment__c == 'QCS - Other' && oEnahncemnetApproval.Other_QCS__c ==Null ){ ApexPages.Message myMsg = new ApexPages.Message(ApexPages.Severity.ERROR,'Other QCS is Required when Environment is equal to "QCS - Other"'); ApexPages.addMessage(myMsg); return null; } oCase.Status=this.casestatus; update oCase; Enhancement_Approval__c oEA; oEA = new Enhancement_Approval__c(); oEA.Approved_For__c = oEnahncemnetApproval.Approved_For__c; oEA.Case__c = ApexPages.currentPage().getParameters().get('id'); oEA.Environment__c = oEnahncemnetApproval.Environment__c; oEA.Valid_From__c = oEnahncemnetApproval.Valid_From__c; oEA.Valid_To__c = oEnahncemnetApproval.Valid_To__c; oEA.Other_QCS__c = oEnahncemnetApproval.Other_QCS__c; insert oEA; if (casecomment.CommentBody != null){ casecomment.ParentId = ApexPages.currentPage().getParameters().get('id'); insert casecomment; } PageReference casePage = new ApexPages.StandardController(oCase).view(); casePage.setRedirect(true); return casePage ; } //*************************************************************************** //** Test Method //** //*************************************************************************** public static testMethod void testChangeBoardApproval() { pageReference p = Page.ChangeBoardApproval; p.getParameters().put('id', [select id from Case limit 1].id); test.setCurrentPage(p); newEnhancemnetController enhancmenetController = new newEnhancemnetController(); //enhancemnetController.cancel(); enhancmenetController.getCase(); enhancmenetController.getitems(); enhancmenetController.getcasestatus(); enhancmenetController.getEnhancementApproval(); enhancmenetController.getContact(); enhancmenetController.getCaseComment(); enhancmenetController.save(); } }

 

 

 

 

 

  • January 25, 2010
  • Like
  • 0

Have the following enum in a controller extension:

 

 

public enum ApprovalState { NotRequired, Required, Pending }

public ApprovalState CurrentApprovalState { get; set; }

 

 

And the following VF snippet:

 

 

<apex:commandButton disabled="{!currentApprovalState != ApprovalState.NotRequired}" />

 

When I attempt to save the VF page, I get "Save error: Unknown property 'Quote__cStandardController.ApprovalState'"
 
 Am I using the wrong syntax to access the enum data type?

 

 

 

 

I'd like to pass an Apex class that I've defined as a public inner class to a Visualforce component. When I try to save the component, I get these errors:

 

Error: Unsupported type SimpleOuter.SimpleInner[] encountered.

Error: Apex class 'simpleouter.simpleinner' does not exist.

 

Here's my sample code:

 

 

public with sharing class SimpleOuter {
public class SimpleInner {
public String one;
public String two;
}
}

<apex:component>
<apex:attribute name="phoneStatuses" type="SimpleOuter.SimpleInner[]" required="true"
description="The phone numbers and statuses to display." />
</apex:component>

 

 Any ideas?

 

  • September 18, 2009
  • Like
  • 0
I am trying to send an email with Apex using a visualforce page as the html body of the email by using PageReference.getContent(); However, when I call getContent() it is rendering the page without the one repeat component. I know that the collection the repeat is iterating over has data because if I redirect to the same PageReference the repeat component gets rendered as expected. The apex code looks like this:
 

PageReference emailTemplate = Page.ProjectInvoiceTrackingEmailTemplate;Blob emailBody = emailTemplate.getContent();System.debug(emailBody.toString());

 the template looks like this:

 

<apex:page id="templatePage" sidebar="false" showHeader="false" controller="ProjectInvoiceEmailController"> <h1>Template header</h1> <apex:repeat value="{!actualProjectsToNotify}" var="project" rendered="true"> <apex:outputText value="{!project.projectName}" /> </apex:repeat> <h3>page end</h3></apex:page>

Does anyone have any ideas why this wouldn't be rendered when calling getContent(), but it is rendered when that same page reference is rendered in the browser? 

 

 

 
  • May 20, 2009
  • Like
  • 1

Hi,

I am working on an Visualforce page for opportunity object, I need to ask user to select a pricebook for the opportunity.

 

It is straight forward for standard users - just show all active pricebooks, but parter users can only access the pricebooks defined in pricebook sharing.

 

How do I find out what pricebooks the current user can use in Apex code?

 

Thanks,

Ian

   

Hi, we have had with the new realease "Spring 09" some issues. It seems that in Spring 09 release a changed had been introduced in profile permission. You can't anymore query any field from Profile object if you had not set "view setup and configuration permission" in the profile of the user running the application.

 

This is the test I made, and here the code:

 

-Controller

public class TestProfileBug {

   
    public TestProfileBug()
    {
        User u = [Select Id, Profile.Name from User limit 1];   
    }
}

 

 

-Page

 

<apex:smileytongue:age controller="TestProfileBug" >
<!-- Begin Default Content REMOVE THIS -->
<h1>Congratulations</h1>
This is your new Page
<!-- End Default Content REMOVE THIS -->
</apex:smileytongue:age>

 

 

Here we go with test result.

 

With a profile without "view setup and configuration permission"

 

This error appears:

 

"No such column 'ProfileId' on entity 'User'. 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."

 

With a profile with "view setup and configuration permission"  shows the page correctly.

 

My code doens't have any ProfileId, but internal salesforce's framework query this field to get the profile name.

 

Other thing is that if I save my controller and then log-in with a profile that don't have this permission all work great the first time. Then, I reload the page and the previous error appears.

 

I tried other ways to get profile name without any success. I think that this is the expected behavior, but it has to be a way that my code running under profile without this permission can query this object. I tried with System.RunAs(user) but as in previous release it seems not to be working in classes only with unit testing.

 

Any help about that will be appreciated. If possible, we would like to keep this permision away for almost all profiles for security reasons.

 

Thanks.

Joaquin

What is the best way to test methods annotated with @future? I have one such method that updates account records, but I am unable to write any meaningful tests, because I can't wait until it is finished executing to test the updated rows. Does anyone have any suggesstions?
  • January 27, 2009
  • Like
  • 0
Hi,
 
I am a new bee to Apex development.
I am trying to generate Apex class from Fedex shipping WSDL file.
 
After parsing the file, I tried to generate the Apex class but I was getting the following error,
 
Apex generation failed.
Error message:
Error: Unsupported WSDL. Operation 'deleteShipment' has more than one output element.
 
How do I generate the Apex class?
 
please throw some light on it.
 
thanks
sk
  • June 26, 2008
  • Like
  • 0