• JasonGabler
  • NEWBIE
  • 160 Points
  • Member since 2009

  • Chatter
    Feed
  • 6
    Best Answers
  • 1
    Likes Received
  • 0
    Likes Given
  • 25
    Questions
  • 43
    Replies

When I tried {!$Resource.resources_name} in my Site's VF pages, I see the "/resource/..." URL, which does not work for the host address of my Site.  All I see, for example for images, are broken image icons.  If I take the relative URL supplied by the {!$Resource...} and put it on the hostname of my Salesforce instance when logged into Salesforce proper, it works fine. I know that all permissions are properly set for the Site guest user profile (unless I missed a specific one for static resources somewhere).  I did set the caching for each resource to public.   If I am logged into Salesforce proper and looking at my Site, that s the only way I can see the static resources. Of course, my future customers will not be able to see them.

 

Any suggestions?

Open your IDE for a project, use the Add/Remove Components dialog and for v23 the "Email" folder does not appear.  

 

... if only there was a place to post bugs.

 

jason


Here's a simple trigger intended to update one Contact lookup field (c.Affiliate_Admin__c) with an analogous Contact lookup field (Notification_Recipient__c) whenever the Contact is created or updated.  The Notification_Recipient is found by looking at the Contact's Account record.

 

trigger Contact_setAffiliateAdmin on Contact (before insert, before update) {

    for(Contact c: Trigger.new) {

        if (c.AccountId != null) {

            c.Affiliate_Admin__c =  [SELECT Notification_Recipient__c from Account where Id=:c.AccountId].Notification_Recipient__c;

    }

  }

}

 

Occassionally this line produces the following error:  "List has no rows for assignment to SObject"

 

Mt first thought was that the trigger was encountering Contact records that were not associated with an Account, and so my query produces and empty list (of Accounts) and cannot do the dereference for Notification_Recipient__c.   However, when I run a reporting looking to find Contacts with AccountId = "", I find there are no such records.

 

If Notification_Recipient__c was null, there wouldbe no error message and Affiliate_Admin__c would just be set to null i the assignment, correct?

 

I'm out of ideas... do you have any?  Some other way to verify Contacts with no accounts?

 

thanks,

 

jason

 

I know how to add/remove components for the Home tab's sidebar within the customer portal, but I cannot seem to do this for other tabs.  For example, on Home I am showing Messages and Alerts, and Recent Items.  But on my custom object's tab I only see Recent Items.  Why is that?  Can I configure this?

 

thanks,

 

Jason Gabler

Anyone else having this problem with Web API apps?  Its intermittent this morning with  lightening speed for a request or two,  and then it times out for 5 minutes.

 

Jason Gbler

I have seen Campaigns used for event attendance tracking (whether there's an ROI expected or not).  I have made a one off, simple package for one of my clients.  I haven't seen an AppEx packages for this purpose.  There is EventForce, but that's more for event planning rather than event attendance.  What do you use?  

 

I'd like to use Campaigns, but I'm wondering if anyone's had any pitfalls with going this route.

 

Jason Gabler

I've recently encountered the phenomenon in which new/edited contact workflow rules are triggered when moving a contact record from one account to another.  I'm surprised I have not noticed this before.    I was updating contacts via the Web API, changing their account affiliation, and to my surprise some e-mails were sent out because a workflow that triggers on "When a record is created, or when a record is edited and did not previously meet the rule criteria" for contacts" fired off.  I also saw that just changing an contact's account within Salesforce (using the web UI) has the same effect.

 

I assume this means that "new contact" in Salesforce means "contact is new to an account"?    

 

Is this true?  Is there a way to keep such workflows from firing?   I can assure you that the rule criteria has nothing to do with the contact's account.  Such a change should not be firing the workflow.

 

thanks,

 

Jason Gabler

I go to:  Administration Setup -> Security Controls -> Field Accessibility.  I select one of my custom objects. I click "View by Profiles." Then, I open up the "Profile:" select list and I do not see the profile for my Sites guest user.  Did something change?  I see no way to configure field by field access control in the site user's profile either.

 

thanks,

 

Jason Gabler

I have a fairly involved custom app running on a Force.com Site.  I get emails from Salesforce when a Controller bombs, but when a VF page fails to load I get no notice.   I realize I can go into the Site in administrative mode, however I am trying to track down an error, reported by end-users,  which I have been unable to reproduce.  I want to find some record of when this happens for end-users.   The debug log (Setup -> Admin Setup -> Debug Logging) is really odd.  I only see the log lines for a user if I filter for on... ok, fine, I added the Guest User for my Site.  However, I only see log entries that come since I began to look at the log.  There's no history?  There's also no refresh button or automated refresh for watching the log.  I have to reload the log page to see new entries, which would be fine except that after a while my user filter disappears.  

 

Am I not use the available facilities properly or is it this difficult?

 

thanks,

 

jason

The Visualforce and Apex below is being used via an externally, anonymously accessible Force.com site.  The error text is:

 

  • Maximum view state size limit (128KB) exceeded. Actual view state size for this page was 149.953KB

 

 

 

I've been reading more than a few threads on file upload sizes and the state size, but most are old.  In fact, most claim you can do a 5MB upload, so I don't understand the problem, because, despite what I describe next, this error only shows up when I upload a file that's more than 100K or so.

 

Now, I do have a rather large object floating around in the state (on the order of one hundred fields, with many text areas and rich text areas of up to 4500 char limit).  This object is kept around because I am in a 10 page wizard and figure loading it all the time might not be as good just keeping it readily available, especially since I cannot load all fields without doing the ridiculous task of having to inspect the schema to get all field names etc...

 

Anyhow,  I'm going to guess this isn't a one shot answer.  So I'm expecting some more questions and discussion.

 

jason

 

 

 

 

 

<apex:inputFile id="irs_2009" value="{!uploadBody}" filename="{!rfq.irs_2009__c}" styleClass="input-file"/>
<apex:commandButton value="Upload Attachment" action="{!irs2009Upload}"  styleClass="upload-button"/>

public Blob uploadBody {get; set;}   
public PageReference irs2009Upload() { uploadFile('IRS 990 2009 - '+rfq.irs_2009__c); return null;}

public void uploadFile(String uploadName) {
    if(uploadBody != null && uploadName != null) {  
      Attachment att = new Attachment();  
      att.Body = uploadBody;
      att.Name = uploadName;
      save(); // this ensures that 'rfq' in the next line is not null
      att.ParentId = rfq.Id;  
      insert att;    	
    }   
  }

 

 

 

 

 

 

 

 

 

 

 

 

Here's my javascript, pasted from my Force.com IDE.  Pay particular attention to the bold lines.

 

 

<script type="text/javascript">
  $(document).ready(function() {
  	$('#submit').attr('value', '');
  	$('#gate-form').submit(function() {
	  	var pass = true;
	  	for(var i=1; i<7; i++) {
	  		if (!$('#q'+i).attr('checked')) {
	  			pass = false;
	  		}
	  	}
	 		if (pass) {
	 			location.replace = '/somepage';
			} else {
				alert('fail :(');
			}
			return false;
		});
	});
</script>

 

 

Here it is, pasted from my browser's page source.  We can see what the VF compiler did.  If its not obvious at first, notice that my location.href got chopped up and the "replace = '/somepage'"  was inserted into the preceding for loop, breaking the syntax, breaking the JS compiling in my browser.

 

 

 

<script type="text/javascript">
  $(document).ready(function() {
   $('#submit').attr('value', '');
   $('#gate-form').submit(function() {
    var pass = true;
    for(var i=1; i<7 replace="/RFQ_Page_1" ; i++) {
     if (!$('#q'+i).attr('checked')) {
      pass = false;
     }
    }
    if (pass) {
     location.;
   } else {
    alert('fail :(');
   }
   return false;
  });
 });
</script>

 

 

This is pretty bizarre.  I'm trying to find a way to work around.  If you have any ideas please let me know.  Btw, this happens whether I use 'window.' before location or not,  and also happens whether I use location.href or location.replace.

 

Should I post a bug report somewhere?

 

 

jason

This is for a Visualforce page on a Force.com Site.  The purpose here is to get a function to run upon page load that will redirect if an certain value is not present in the controller.  I've whittled all of that logic out for the purpose of testing the "action" functionality

 

The documentation for the <apex:page>  "action" attribute states:

 

 

  • The action method invoked when this page is requested by the server. Use expression language to reference an action method. For example, action="{!doAction}" references the doAction() method in the controller. If an action is not specified, the page loads as usual. If the action method returns null, the page simply refreshes. This method will be called before the page is rendered and allows you to optionally redirect the user to another page. This action should not be used for initialization.

 

 

 

To me this means:  you can execute a function when the page is requested, and in that function you can get your end user to land on an entirely different page.

 

Here's my code:

 

 

<apex:page cache="false" sidebar="false" showHeader="false" controller="RFQ_Wizard_Controller" action="{!checkId}" > 

 

 

and, I've tried these two action methods

 

 

  public String checkId() {
     return Page.RFQ_Not_Found.getUrl;
 }

... o r...

  public PageReference checkId() {
     return Page.RFQ_Not_Found;
 }

 

I've done some debugging, and I have verified that they do, in fact, execute.  Is there some way within Apex that I can force the controller to redirect to another page?   It seems that the Visualforce's apex:page "action" doesn't actually do anything with this output of the action method.

 

 

 

We have a fairly long and involved wizard-like form that our testers are taking their time to fill out, and some times leaving untouched for an hour or more.  When they return to filling out the form, it is having problems submitting.  I am starting to suspect that the instance of the custom controller behind the wizard is for a given form is disappear (like a JSESSION timing out).

 

How exactly does the life span of a controller instance work?  How long is it around for?  Can this life span be manipulated?  I haven't found anything pertinent in the VF or Apex docs.  Any insights would be appreciated.

 

thanks,

 

jason

I have about 40 custom validations on one form, and at least as many standard validations (e.g. required, etc).  I have finished all of it, and then went to test, from scratch, and all of my custom validations did not fire.  I'm trying to think if there was some switch I inadvertently toggle....  any ideas?

 

thanks,

 

jason 

When I force multiple validation errors on a VF page, and the error messages are set to be shown near the fields, I only get one validation error showing at a time.  This means the user would have to attempt to submit the form once per validation error... see a red error, correct it, submit, see the next one, correct it, submit, and so on.  Is there a way to get the page to light up with multiple error messages shown at the fields?

 

thanks,

 

jason

 

I've been successfully uploading files, but unless I setRedirect(true) on my upload function's returned PageReferece,  the PageReference does not get honored.  Ultimately I'd like to come back to the same page, without redirecting (so, keeping form data intact)  and include an anchor upon returning to the page so as to end up at a given spot in the page.  Otherwise, with my upload sub-form in the middle of the page, when I return after the upload my browser confusingly  ends up at the top of the page.  Any ideas?  Here's what I've been trying...

 

 

My sippet of VF:

 

 

 

 

  <div id="upload" class="upload">
    <table><tr>
      <td><apex:inputFile id="fileToUpload" value="{!fileBody}" filename="{!fileName}" styleClass="input-file"/></td>  
      <td><apex:commandButton value="Upload Attachment" action="{!uploadFile}"  styleClass="upload-button"/></td>
    </tr></table>
  </div>              

 

 

 

 

 

Snipper of Apex from the controller:

 

 

 

  public PageReference uploadFile(String fileName, Blob fileBody) {
     if(fileBody != null && fileName != null) {  
      Attachment myAttachment  = new Attachment();  
      myAttachment.Body = fileBody;  
      myAttachment.Name = fileName;
      ....
    }   
    PageReference pr = ApexPages.currentPage();
    pr.setAnchor('someplace');
    return pr;
  }

 

jason

Is there an elegant solution/work-around to the limit of 25 Long Text Areas per object?  I've got some ideas, but nothing very elegant.  Strangely, I've come up with nothing while searching.  I would not be looking forward to create child objects just to get around this...

 

thanks,

 

jason

I created a custom object, a template , page.  It renders just fine.  I created a new custom object, similar in structure to the first.  I took that VF page and copied it, changed the StandardController and new inputFields to follow the new object's API name.  This second page will not render if I put inputFields into it.  If I take the inputField out all is good and the page renders in the template as otherwise expected.  Putting the inputField's back in, I get no error msgs in the IDE or on the page.  I've put <site:previeAsAdmin/> in various places in the template and this second page.  No errors print out at all.  In fact, when I have an inputField in the page, the apex:outputLabels don't show, nothing does but the template itself.   How can I find out what errors are occurring?

 

thank,

 

jason

 

[EDIT]  I created a custom tab to view the page directly within Salesforce (as opposed to a site).  Everything works fine when I view the VF page as a tab within Salesforce, logged in, of course.  This would seem to point to some sort of access issue.  However, the site's profile has access to the page, the template, all fields' security is set to "editable" or "read-only".   In fact, when I've forgotten to set field security in the past, the field won't show, but the rest of the page will still render... so, I'm glad,. at least I can view the page as a tab, but this must show on the site.  So, over all, I'm more perplexed than before :robotsurprised: 

 

[EDIT]  OK, so I went into the manage page for my site, set this offending VF page as my sites home page and then clicked on the "Preview as Admin" link and saw this:  "Read access not found for RFQ_2__c".  Well that's good... now I just have to figure out why the site does not have object-level access to this object... even though the site is configured to.

 

In the code below I place a custom id of primary_contact_phone into the inputField.  When the form field is rendered, the actual markup id is "j_id0:rfq_form:j_id7:primary_contact_phone".  I have some complicated styling to do and I want to create my own <label>s, instead of using the built-in blockSection labels.  So when using the "for" attribute, I want to do <label for="primary_contact_phone">.  Of course, that does not work, I need to have <label for="j_id0:rfq_form:j_id7:primary_contact_phone">.  But this is rendered by Salesforce and I do not know what it will be.  I have been trying to access the id with attempts like  {!$Component.rfq_form.primary_contact_phone}.  I've also been reading on how to access IDs for using with Javascript in the VF reference, and I've done this before.  But I cannot seem to get that darn ID.  Any ideas on how to properly get the ID of the input field?

 

 

 

<apex:page cache="false" sidebar="false" showHeader="false" standardController="RFQ__c">

    <apex:form id="rfq_form">

        <apex:inputField value="{!RFQ__c.primary_contact_phone__c}" id="primary_contact_phone"/>

        ....

    </apex:form>

</apex:page>

 

thanks,

jyg

I've installed the latest MUW for a customer, and when doing the post-install configuration for setting the Edit/Clone/New buttons, I find that there's no "SelectValueEdit" Visualforce page for the "MUW Select Value" object. 

 

Anyone else experienced this?  Or is there something I might be doing wrong?

 

thanks,

 

Jason Gabler 

I've recently encountered the phenomenon in which new/edited contact workflow rules are triggered when moving a contact record from one account to another.  I'm surprised I have not noticed this before.    I was updating contacts via the Web API, changing their account affiliation, and to my surprise some e-mails were sent out because a workflow that triggers on "When a record is created, or when a record is edited and did not previously meet the rule criteria" for contacts" fired off.  I also saw that just changing an contact's account within Salesforce (using the web UI) has the same effect.

 

I assume this means that "new contact" in Salesforce means "contact is new to an account"?    

 

Is this true?  Is there a way to keep such workflows from firing?   I can assure you that the rule criteria has nothing to do with the contact's account.  Such a change should not be firing the workflow.

 

thanks,

 

Jason Gabler

When I tried {!$Resource.resources_name} in my Site's VF pages, I see the "/resource/..." URL, which does not work for the host address of my Site.  All I see, for example for images, are broken image icons.  If I take the relative URL supplied by the {!$Resource...} and put it on the hostname of my Salesforce instance when logged into Salesforce proper, it works fine. I know that all permissions are properly set for the Site guest user profile (unless I missed a specific one for static resources somewhere).  I did set the caching for each resource to public.   If I am logged into Salesforce proper and looking at my Site, that s the only way I can see the static resources. Of course, my future customers will not be able to see them.

 

Any suggestions?

The email folder for email templates is missing from "Add/Remove Metadata Components" in the Force.Com IDE Winter '12 edition (23.0.1.201111041306).  Was this removed?

  • November 14, 2011
  • Like
  • 0


Here's a simple trigger intended to update one Contact lookup field (c.Affiliate_Admin__c) with an analogous Contact lookup field (Notification_Recipient__c) whenever the Contact is created or updated.  The Notification_Recipient is found by looking at the Contact's Account record.

 

trigger Contact_setAffiliateAdmin on Contact (before insert, before update) {

    for(Contact c: Trigger.new) {

        if (c.AccountId != null) {

            c.Affiliate_Admin__c =  [SELECT Notification_Recipient__c from Account where Id=:c.AccountId].Notification_Recipient__c;

    }

  }

}

 

Occassionally this line produces the following error:  "List has no rows for assignment to SObject"

 

Mt first thought was that the trigger was encountering Contact records that were not associated with an Account, and so my query produces and empty list (of Accounts) and cannot do the dereference for Notification_Recipient__c.   However, when I run a reporting looking to find Contacts with AccountId = "", I find there are no such records.

 

If Notification_Recipient__c was null, there wouldbe no error message and Affiliate_Admin__c would just be set to null i the assignment, correct?

 

I'm out of ideas... do you have any?  Some other way to verify Contacts with no accounts?

 

thanks,

 

jason

 

 

Hi all,

 

  i have developed an application using sales force api recently.Now i have a problem when i am uploading the file physically to salesforce from my applicaton.can u give the solution for this. 


 

Hello All

 

I have a force.com site in which users (i call them users but they are just contacts in my Org, not real SF users) can login and log cases, attach files etc. (please ignore the similarity to cutomer portal - it is a given state).

 

another functionality is that a user can view logged cases along with their comments and attachments (and is able to download the attachments).

everything was working fine untill i created an assignment rule for the new cases inserted to be directed to a queue.

Now, once the user logs in to the site and tries to download an attachment, he gets an authoriztion required page.

 

Now, i was thinking permissions - but i can still see the case, comments and attachments just fine. the only thing that isnt working is when i try to download an attachment.

 

I am using the

{!URLFOR($Action.Attachment.Download, attachmentId)}

syntax.

 

any insights will be most appreciated.

 

 

When I add software, it connects through my prxy, installs a bunch of components, but the cannot complete:

 

Cannot complete the install because one or more required items could not be found.
  Software being installed: Force.com IDE 20.0.1.201011121559 (com.salesforce.ide.feature.feature.group 20.0.1.201011121559)
  Missing requirement: Common Frameworks 1.1.300.v200904160730 (org.eclipse.wst.common.frameworks 1.1.300.v200904160730) requires 'bundle org.eclipse.emf.ecore [2.4.0,3.0.0)' but it could not be found
  Cannot satisfy dependency:
    From: Force.com IDE 20.0.1.201011121559 (com.salesforce.ide.feature.feature.group 20.0.1.201011121559)
    To: org.eclipse.wst.validation 0.0.0
  Cannot satisfy dependency:
    From: Validation Framework 1.2.104.v200911120201 (org.eclipse.wst.validation 1.2.104.v200911120201)
    To: bundle org.eclipse.wst.common.frameworks [1.1.200,2.0.0)

So is anybody else having this issue? When I try and open a file from the SVN history pane I get this error:

 

If I change the editor for apex classes from the force.com IDE editor to the general text editor under Preferences > General > File Associations it loads, but I miss out on all the IDE goodness on all apex class editing across the board.

 

Any ideas on how I can fix this? I have having to use an external app to get access to my SVN history.

 

Using OS X with the standalone eclipse + force.com IDE as a plugin if that helps.

Any ideas?

 

 

Anyone else having this problem with Web API apps?  Its intermittent this morning with  lightening speed for a request or two,  and then it times out for 5 minutes.

 

Jason Gbler

I'm getting the attached error when attempting to install the latest Force.com IDE plugin on the latest Eclipse version with the latest JDK installed.  The error comes up after I click next on the "Available Software" selection screen of the "Install New Software" dialog.  How can I fix this problem?  Thank you!

 

 

Cannot complete the install because of a conflicting dependency.
  Software being installed: Force.com IDE 20.0.1.201011121559 (com.salesforce.ide.feature.feature.group 20.0.1.201011121559)
  Software currently installed: Shared profile 1.0.0.1284708747720 (SharedProfile_epp.package.java 1.0.0.1284708747720)
  Only one of the following can be installed at once: 
    Structured Source Editor 1.2.2.v201008232126 (org.eclipse.wst.sse.ui 1.2.2.v201008232126)
    Structured Source Editor 1.1.102.v200910200227 (org.eclipse.wst.sse.ui 1.1.102.v200910200227)
  Cannot satisfy dependency:
    From: Shared profile 1.0.0.1284708747720 (SharedProfile_epp.package.java 1.0.0.1284708747720)
    To: org.eclipse.wst.sse.ui [1.2.2.v201008232126]
  Cannot satisfy dependency:
    From: Force.com IDE 20.0.1.201011121559 (com.salesforce.ide.feature.feature.group 20.0.1.201011121559)
    To: org.eclipse.wst.html.ui [1.0.0,2.0.0)
  Cannot satisfy dependency:
    From: HTML UI Source Editor 1.0.401.v200908111935 (org.eclipse.wst.html.ui 1.0.401.v200908111935)
    To: bundle org.eclipse.wst.sse.ui [1.1.0,1.2.0)

 

 

  • February 03, 2011
  • Like
  • 0

I've recently encountered the phenomenon in which new/edited contact workflow rules are triggered when moving a contact record from one account to another.  I'm surprised I have not noticed this before.    I was updating contacts via the Web API, changing their account affiliation, and to my surprise some e-mails were sent out because a workflow that triggers on "When a record is created, or when a record is edited and did not previously meet the rule criteria" for contacts" fired off.  I also saw that just changing an contact's account within Salesforce (using the web UI) has the same effect.

 

I assume this means that "new contact" in Salesforce means "contact is new to an account"?    

 

Is this true?  Is there a way to keep such workflows from firing?   I can assure you that the rule criteria has nothing to do with the contact's account.  Such a change should not be firing the workflow.

 

thanks,

 

Jason Gabler

I go to:  Administration Setup -> Security Controls -> Field Accessibility.  I select one of my custom objects. I click "View by Profiles." Then, I open up the "Profile:" select list and I do not see the profile for my Sites guest user.  Did something change?  I see no way to configure field by field access control in the site user's profile either.

 

thanks,

 

Jason Gabler

With Winter '11, if you create a Site, a new Salesforce-provided class gets deployed to your org: MyProfilePageController.cls

 

There is test code in this class that fails if you don't have a portal user installed. This prevents you from doing anything in that org that requires running all tests.

 

Here is the error:

 

System.QueryException: List has no rows for assignment to SObject

Class.MyProfilePageController.testSave: line 78, column 35 External entry point

 

and the line in question:

 

 

User existingPortalUser = [SELECT id, profileId, userRoleId FROM User WHERE UserRoleId <> null AND UserType='CustomerSuccess' LIMIT 1];

 

This failure prevents doing any save from Eclipse. You can't deploy new code, edit object metadata files, etc. Complete showstopper.

 

Can anyone:

 * confirm this (we think reproducing will require that you create a new Site, perhaps the first Site in the org, after Winter 11)

 * think of a work-around (tried enabling self-service portal, but it doesn't create the required user type)

 

Anyone from Salesforce confirm that this is a bug and not something we're doing wrong?

 

Thanks!

 

Here is the entire class:

 

/**
 * An apex class that keeps updates of a portal user in sync with its corresponding contact.
   Guest users are never able to access this page.
 */
public class MyProfilePageController {

    private User user;
    private boolean isEdit = false;
    
    public User getUser() {
        return user;
    }

    public MyProfilePageController() {
        user = [SELECT id, email, username, usertype, communitynickname, timezonesidkey, languagelocalekey, firstname, lastname, phone, title,
                street, city, country, postalcode, state, localesidkey, mobilephone, extension, fax, contact.email
                FROM User
                WHERE id = :UserInfo.getUserId()];
        // guest users should never be able to access this page
        if (user.usertype == 'GUEST') {
            throw new NoAccessException();
        }
    }
    
    public Boolean getIsEdit() {
        return isEdit;
    }
    
    public void edit() {
        isEdit=true;
    }    
    
    public void save() {
        if (user.contact != null) {              
            setContactFields(user.contact);
        }
        
        try {
            update user;
            if (user.contact != null) { 
                update user.contact;
            }
            isEdit=false;
        } catch(DmlException e) {
            ApexPages.addMessages(e);
        }
    }
    
    public PageReference changePassword() {
        return Page.ChangePassword;
    }
    
    public void cancel() {
        isEdit=false;
        user = [SELECT id, email, username, communitynickname, timezonesidkey, languagelocalekey, firstname, lastname, phone, title,
                street, city, country, postalcode, state, localesidkey, mobilephone, extension, fax, contact.email
                FROM User
                WHERE id = :UserInfo.getUserId()];
    }
    
    private void setContactFields(Contact c) {
        c.title = user.title;
        c.firstname = user.firstname;
        c.lastname = user.lastname;
        c.email = user.email;
        c.phone = user.phone;
        c.mobilephone = user.mobilephone;
        c.fax = user.fax;
        c.mailingstreet = user.street;
        c.mailingcity = user.city;
        c.mailingstate = user.state;
        c.mailingpostalcode = user.postalcode;
        c.mailingcountry = user.country;
    }

    static testMethod void testSave() {         
        // Modify the test to query for a portal user that exists in your org
        User existingPortalUser = [SELECT id, profileId, userRoleId FROM User WHERE UserRoleId <> null AND UserType='CustomerSuccess' LIMIT 1];
        System.assert(existingPortalUser != null, 'This test depends on an existing test portal user to run');
        
        String randFax = Math.rint(Math.random() * 1000) + '5551234';
        
        System.runAs(existingPortalUser) {
            MyProfilePageController controller = new MyProfilePageController();
            System.assertEquals(existingPortalUser.Id, controller.getUser().Id, 'Did not successfully load the current user');
            System.assert(controller.isEdit == false, 'isEdit should default to false');
            controller.edit();
            System.assert(controller.isEdit == true);
            
            controller.cancel();
            System.assert(controller.isEdit == false);
            
            controller.getUser().Fax = randFax;
            controller.save();
            System.assert(controller.isEdit == false);
        }
        
        // verify that the user and contact were updated
        existingPortalUser = [Select id, fax, Contact.Fax from User where id =: existingPortalUser.Id];
        System.assert(existingPortalUser.fax == randFax);
        System.assert(existingPortalUser.Contact.fax == randFax);
    }

}

 

 

 

  • October 15, 2010
  • Like
  • 0

We are receiving this error only in client orgs that have been upgraded to Winter '11:

 

No such column '[FIELD - we have seen CurrencyIsoCode and RecordTypeId]' on entity '[OBJECT - we have seen Contact, User, and Opportunity]'. 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.

We are unable to replicate this in our developer org and the debug logs from the client orgs are not helpful. None of our Apex code queries or references currency fields let alone CurrencyIsoCode and do not query for RecordTypeId on Contact, Opportunity, or User. The client orgs do not have multiple currencies enabled.

 

 

This could potentially be a serious issue when the rest of the Salesforce instances are upgraded to Winter '11 this coming weekend.

 

We have additionally logged a case with Salesforce. Any thoughts are greatly appreciated.

The Visualforce and Apex below is being used via an externally, anonymously accessible Force.com site.  The error text is:

 

  • Maximum view state size limit (128KB) exceeded. Actual view state size for this page was 149.953KB

 

 

 

I've been reading more than a few threads on file upload sizes and the state size, but most are old.  In fact, most claim you can do a 5MB upload, so I don't understand the problem, because, despite what I describe next, this error only shows up when I upload a file that's more than 100K or so.

 

Now, I do have a rather large object floating around in the state (on the order of one hundred fields, with many text areas and rich text areas of up to 4500 char limit).  This object is kept around because I am in a 10 page wizard and figure loading it all the time might not be as good just keeping it readily available, especially since I cannot load all fields without doing the ridiculous task of having to inspect the schema to get all field names etc...

 

Anyhow,  I'm going to guess this isn't a one shot answer.  So I'm expecting some more questions and discussion.

 

jason

 

 

 

 

 

<apex:inputFile id="irs_2009" value="{!uploadBody}" filename="{!rfq.irs_2009__c}" styleClass="input-file"/>
<apex:commandButton value="Upload Attachment" action="{!irs2009Upload}"  styleClass="upload-button"/>

public Blob uploadBody {get; set;}   
public PageReference irs2009Upload() { uploadFile('IRS 990 2009 - '+rfq.irs_2009__c); return null;}

public void uploadFile(String uploadName) {
    if(uploadBody != null && uploadName != null) {  
      Attachment att = new Attachment();  
      att.Body = uploadBody;
      att.Name = uploadName;
      save(); // this ensures that 'rfq' in the next line is not null
      att.ParentId = rfq.Id;  
      insert att;    	
    }   
  }

 

 

 

 

 

 

 

 

 

 

I am creating a visualforce page that will live in a section on the contact page.  I am trying to get the page to redirect to an external site, but the entire contact page ends up getting redirected.  I used to be able to do this easily with S-controls, but I'm running into issues using visualforce.  My code is as follows:

 

 

<apex:page StandardController="Contact" extensions="pamExt" action="{!getRedir}" > </apex:page>

 

 where as you may have been able to guess getRedir returns a url.  Can anyone explain to me why this redirects the entire Contact page and maybe give a way that I can fix this so only this vforce page gets redirected?

Thanks

 

I have a custom formula field (shipping_total__c) that is the sum of two other fields (shipping1__c, shipping2__c), and I have created a visualforce page that displays the latter two fields in <apex:inputfield> tags, and the formula field in an <apex:outputfield> tag. I am trying to get the formula field to rerender with the correct amount any time the first two are modified, but the value does not change.

I suspect that the field formula is not re-calculating after it is originally retrieved from the opportunity object via SOQL on initial page display.

If I try to modify those fields,

Code:
this.opportunity.shipping_total__c = this.opportunity.shipping1__c + this.opportunity.shipping2__c;

... I get an Apex error that this field is read-only.

I *could* create a temp decimal variable and display that instead, and then update it onchange of the first two shipping values, but that seems like more work than should be necessary.


How can I force a formula field to re-render without actually committing/updating the data back to the DB first?


  • November 20, 2008
  • Like
  • 0
apex:inputFile can not be used in conjunction with an action component, apex:commandButton or apex:commandLink that specifies a rerender or oncomplete attribute.

Is it because  POST is required to upload the file ?




Message Edited by devNut! on 11-18-2008 11:30 AM