• DaveL
  • NEWBIE
  • 75 Points
  • Member since 2011
  • Software Developer
  • Interlochen Center for the Arts

  • Chatter
    Feed
  • 3
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 5
    Questions
  • 11
    Replies

 

 

 

I have developed a daily poll component for the force.com based site.

 

I have used customer portal to authenticate users.

I have added that component within the right hand template.

<apex:component allowDML="true" controller="cybVotePoll" id="Poll">

<apex:pageBlock title="Today's&nbsp;Poll" id="PollPageBlock" mode="edit">

<apex:panelgrid id="Graph" columns="1">

<apex:outputLabel value="{!PollQuestion}"style="font-size:12px;font-style:italic;color:#0000ff;font-weight:bold;" />

<apex:outputLabel value="{!Msg}" style="color:#ff0000;" id="msg" />

<apex:form >

<apex:selectRadio value="{!UserVote}" id="ResponsePanel" disabled="{!DisableOptions}">

 <apex:selectOptions value="{!ResponseOptions}" />

<apex:actionSupport event="onclick" action="{!SubmitVote}"rerender="ResponsePanel,msg,OutputResult" status="test" />

 </apex:selectRadio>

</apex:form>

<apex:actionStatus id="test" startText="submitting vote..." />

<apex:image width="200" height="150" url="{!ResponseUrl}"id="OutputResult" />

<apex:form >

<apex:commandLink action="{!showPastResults}"value="Past Results >>" />

</apex:form>

</apex:panelgrid>

</apex:pageBlock>

</apex:component>

  

Whenever the radio option is selected on the page, it shows error page with error as insufficient privilege.

I have removed all ther crud rights from the profile so that user could not get access to salesforce standard pages.

Please any one guide me on this issue.

Trying to test HTTP callouts, after setting up test data.  Error is "System.CalloutException: You have uncommitted work pending."  I thought that wrapping the test in Test.startTest() and Test.stopTest() would allow one to setup test data, and then exercise the callout. (based on many previous answers to this sort of question, and prev. experience).  Has this changed with Spring 15 or have I forgotten some fundamental thing?
Can anyone replicate this issue (or tell me what dumb thing I'm (not)doing) ?
Code I'm using to figure this out
@isTest
public class TestMockUnit {
	
	    static testMethod void myUnitTest() {
            // setup theoretical test data (never mind that I don't actually use it, 
            //       this is just to prove that the DML activity survives
            //       across a Test.startTest() )
	        Contact c = new Contact(FirstName = 'Test',  LastName = 'MockCall', BirthDate = Date.valueOf('2000-01-01'), cv__Gender__c = 'Male');
	        insert c;
	        
	    Test.startTest();
	        Test.setMock(HttpCalloutMock.class, new TestMockClass());
                TestMockCallout.doCallout();
            Test.stopTest(); 
   
	    }
        
}

@isTest
global class TestMockClass implements HttpCalloutMock  {

    global HTTPResponse respond(HTTPRequest req) {
        HttpResponse res = new HttpResponse();
        res.setStatusCode(200);
        return res;
    }
}

public class TestMockCallout {
    // my "production" callout.
    public static void doCallout(){
    	    HttpResponse res;
            Http h = new Http();
            HttpRequest req = new HttpRequest();
            req.setHeader('Content-type', 'application/json');
            req.setEndpoint('http://www.google.com');
            req.setMethod('GET');
            res = h.send(req);
    }
}

 
  • March 13, 2015
  • Like
  • 0
We are seeing that apex:inputField where field is of type Rich Text Area are suddenly not rendering on visual force pages tied to our customer portal site.  They render correctly on a recent full sandbox copy that is on Winter 14, so I have ruled out security setting issues (settings which have not been recently changed, and I opened one of the fields up security-wise to prove it was not security).

The other odd thing is that if I use "Manage External User" as an admin, on Firefox, and log into my portal for a particular contact, the fields render.  Same deal on Chrome does not.

Anyone else seeing this?  Have any suggestions?
  • April 21, 2014
  • Like
  • 0

This is a first.  I've submitted a relatively small deployment of a changeset to my production Org and its been "In Progress" for over 8 hrs.  I opened a ticket in w/ SFDC, but we're a non-profit with "basic" support, so my deployment could be "In Progress" for another 2 biz days..

 

 I don't think I can even cancel/retry as my only option is to delete the changeset which doesn't really cancel the job I expect.

 

Anyone else experience this?  I've heard rumors of long deployment times from some vendors, but I've NEVER had one take more than 30 min to go to succeed/fail state.

 

 

 

 

 

  • February 17, 2012
  • Like
  • 0

I am ready to shoot myself.

On 1-25-2012 I was able to deploy changes to my prod org (and had been doing so for months).  On 1-30-2012, on attempting a minor deploy many old unit tests which hadn't been updated in months (one or two in a year) began to fail.  Of course everyone involved (including myself) claim to have made no (relevant) changes.

 

The interesting(?) thing is the failure mode.  In every case a row inserted into a custom object is NOT retrieved by an immediate SOQL select on that object WHEN done in a System.Runas block running as a Customer Portal User.

 

The SAME code runs without error in a Full Sandbox copy that is barely 30 days old.

I have checked / rechecked permissions/sharing rules/object security/all "known" changes, anything I can think of and can see no difference between the two orgs.  I created a new dev org from prod, and it also fails.  So, my assumption is that something changed in my prod org between the 25th and the 30th, but I have not been able to find what that might be.

 

I de-constructed the unit tests down to the following short example unit test which fails on Prod and my newly copied Dev org, but succeeds on my Full Sanbox (30 days old).  If I omit the System.runas, the test succeeds everywhere (however this is obviously not a solution as it invalidates the purpose of the testing).  The original failing tests were written under api 19, upgrading to 23 has had no effect.

 

 Something changed, but I'm at a loss for where else to look.

 

/**
 * 
 */
@isTest
private class RunAs {

    static testMethod void myUnitTest() {
        Contact con =new Contact();
        con.FirstName='FirstTestName';
        con.LastName ='LastTestName';
        con.Email='test@email.com';
        insert con;
       
        User user = new User();
        user.Username ='testemail@test.com';
        user.LastName = 'TestLastName';
        user.Email = 'TestEmail@test.com';
        user.alias = 'testAl';
        user.TimeZoneSidKey = 'America/New_York';
        user.LocaleSidKey = 'en_US';
        user.EmailEncodingKey = 'ISO-8859-1';
        user.ProfileId = [select id from Profile where Name='Student Portal User'].Id;
        user.LanguageLocaleKey = 'en_US';
        user.ContactId=con.Id;
        insert user;
        
        test.Starttest();  
        system.runAs(user){ 
	        Enrollment_Opportunity__c opp = new Enrollment_Opportunity__c(Applicant__c = con.id);
	        insert opp;
	        Enrollment_Opportunity__c readOpp = [select id from Enrollment_Opportunity__c limit 1];
        }
        test.stopTest();
    }
}

  On my prod org this fails on the select  for readOpp with "no rows for query".

  On my full sandbox this succeeds.

  The same results happen even if I assign the user's contact as the owner of the opp record.

   After changing to api 23 I added the seealldata=true to the @istest.  It had no effect.

 

   I clearly don't understand something.....any ideas are appreciated.

  • February 02, 2012
  • Like
  • 0

Having a minor issue.   We implemented the mydomain thing (using myco as an example) and now have myco.my.salesforce.com as our domain.  All well and fine, however I realized that if we forget/need to verify what instance we're using its not available anywhere.....until I found the box at the top of trust.salesforce.com that allows you to enter your "mydomain" and supposedly will tell you what instance you are using.

 

Except it doesn't find the domain which is most definitely the one being used successfully in the url.   sigh.

 

Not a super critical thing as I DO remember what instance I'm on....but wondering if this is a bug on the trust page or a specific issue with our custom domain setup.  Anyone else notice this?

  • June 07, 2011
  • Like
  • 0
Trying to test HTTP callouts, after setting up test data.  Error is "System.CalloutException: You have uncommitted work pending."  I thought that wrapping the test in Test.startTest() and Test.stopTest() would allow one to setup test data, and then exercise the callout. (based on many previous answers to this sort of question, and prev. experience).  Has this changed with Spring 15 or have I forgotten some fundamental thing?
Can anyone replicate this issue (or tell me what dumb thing I'm (not)doing) ?
Code I'm using to figure this out
@isTest
public class TestMockUnit {
	
	    static testMethod void myUnitTest() {
            // setup theoretical test data (never mind that I don't actually use it, 
            //       this is just to prove that the DML activity survives
            //       across a Test.startTest() )
	        Contact c = new Contact(FirstName = 'Test',  LastName = 'MockCall', BirthDate = Date.valueOf('2000-01-01'), cv__Gender__c = 'Male');
	        insert c;
	        
	    Test.startTest();
	        Test.setMock(HttpCalloutMock.class, new TestMockClass());
                TestMockCallout.doCallout();
            Test.stopTest(); 
   
	    }
        
}

@isTest
global class TestMockClass implements HttpCalloutMock  {

    global HTTPResponse respond(HTTPRequest req) {
        HttpResponse res = new HttpResponse();
        res.setStatusCode(200);
        return res;
    }
}

public class TestMockCallout {
    // my "production" callout.
    public static void doCallout(){
    	    HttpResponse res;
            Http h = new Http();
            HttpRequest req = new HttpRequest();
            req.setHeader('Content-type', 'application/json');
            req.setEndpoint('http://www.google.com');
            req.setMethod('GET');
            res = h.send(req);
    }
}

 
  • March 13, 2015
  • Like
  • 0

I'm peridically getting errors in our sandbox (Winter '14) when running tests - Could not run tests on class [class Id].  If I attempt to re-run, it generally works, but one is consistently failing now.

 

There doesn't appear to be any errors with the class itself - any ideas?

 

As a side note, anyone know why the estimated code coverage is no longer visible when viewing the list of classes (Setup > Apex Classes)? 

 

This is a first.  I've submitted a relatively small deployment of a changeset to my production Org and its been "In Progress" for over 8 hrs.  I opened a ticket in w/ SFDC, but we're a non-profit with "basic" support, so my deployment could be "In Progress" for another 2 biz days..

 

 I don't think I can even cancel/retry as my only option is to delete the changeset which doesn't really cancel the job I expect.

 

Anyone else experience this?  I've heard rumors of long deployment times from some vendors, but I've NEVER had one take more than 30 min to go to succeed/fail state.

 

 

 

 

 

  • February 17, 2012
  • Like
  • 0

I am ready to shoot myself.

On 1-25-2012 I was able to deploy changes to my prod org (and had been doing so for months).  On 1-30-2012, on attempting a minor deploy many old unit tests which hadn't been updated in months (one or two in a year) began to fail.  Of course everyone involved (including myself) claim to have made no (relevant) changes.

 

The interesting(?) thing is the failure mode.  In every case a row inserted into a custom object is NOT retrieved by an immediate SOQL select on that object WHEN done in a System.Runas block running as a Customer Portal User.

 

The SAME code runs without error in a Full Sandbox copy that is barely 30 days old.

I have checked / rechecked permissions/sharing rules/object security/all "known" changes, anything I can think of and can see no difference between the two orgs.  I created a new dev org from prod, and it also fails.  So, my assumption is that something changed in my prod org between the 25th and the 30th, but I have not been able to find what that might be.

 

I de-constructed the unit tests down to the following short example unit test which fails on Prod and my newly copied Dev org, but succeeds on my Full Sanbox (30 days old).  If I omit the System.runas, the test succeeds everywhere (however this is obviously not a solution as it invalidates the purpose of the testing).  The original failing tests were written under api 19, upgrading to 23 has had no effect.

 

 Something changed, but I'm at a loss for where else to look.

 

/**
 * 
 */
@isTest
private class RunAs {

    static testMethod void myUnitTest() {
        Contact con =new Contact();
        con.FirstName='FirstTestName';
        con.LastName ='LastTestName';
        con.Email='test@email.com';
        insert con;
       
        User user = new User();
        user.Username ='testemail@test.com';
        user.LastName = 'TestLastName';
        user.Email = 'TestEmail@test.com';
        user.alias = 'testAl';
        user.TimeZoneSidKey = 'America/New_York';
        user.LocaleSidKey = 'en_US';
        user.EmailEncodingKey = 'ISO-8859-1';
        user.ProfileId = [select id from Profile where Name='Student Portal User'].Id;
        user.LanguageLocaleKey = 'en_US';
        user.ContactId=con.Id;
        insert user;
        
        test.Starttest();  
        system.runAs(user){ 
	        Enrollment_Opportunity__c opp = new Enrollment_Opportunity__c(Applicant__c = con.id);
	        insert opp;
	        Enrollment_Opportunity__c readOpp = [select id from Enrollment_Opportunity__c limit 1];
        }
        test.stopTest();
    }
}

  On my prod org this fails on the select  for readOpp with "no rows for query".

  On my full sandbox this succeeds.

  The same results happen even if I assign the user's contact as the owner of the opp record.

   After changing to api 23 I added the seealldata=true to the @istest.  It had no effect.

 

   I clearly don't understand something.....any ideas are appreciated.

  • February 02, 2012
  • Like
  • 0

Having a minor issue.   We implemented the mydomain thing (using myco as an example) and now have myco.my.salesforce.com as our domain.  All well and fine, however I realized that if we forget/need to verify what instance we're using its not available anywhere.....until I found the box at the top of trust.salesforce.com that allows you to enter your "mydomain" and supposedly will tell you what instance you are using.

 

Except it doesn't find the domain which is most definitely the one being used successfully in the url.   sigh.

 

Not a super critical thing as I DO remember what instance I'm on....but wondering if this is a bug on the trust page or a specific issue with our custom domain setup.  Anyone else notice this?

  • June 07, 2011
  • Like
  • 0

Has anyone else noticed some unexpected behavior with the latest version of the Data Loader, version 21.0?  Here is a list of just some of the issues that I've come across that do not occur when using previous versions of the Data Loader:

 

  1. When attempting to update a small subset of fields contained in the .csv file but not all (ie. mapping only a few fields), the Data Loader throws an the Error:  Failed to find mapping for '<one of the unmapped fields in the .csv file>'.  However, if all the fields in the .csv file are mapped, it appears to work correctly.  Previous versions had no problem with mapping only a subset of fields contained in the .csv file, my guess is this is a bug.
  2. After successfully completing an Export, the Data Loader stops responding to any action button click for Insert, Update, Upsert or Delete.  However, it will let you choose Export or Export All.  I cannot tell if this one is a new "feature" or a bug.
Anyone else experiencing any similar issues?  
Thanks in advance!

 

 

 

 

I have developed a daily poll component for the force.com based site.

 

I have used customer portal to authenticate users.

I have added that component within the right hand template.

<apex:component allowDML="true" controller="cybVotePoll" id="Poll">

<apex:pageBlock title="Today's&nbsp;Poll" id="PollPageBlock" mode="edit">

<apex:panelgrid id="Graph" columns="1">

<apex:outputLabel value="{!PollQuestion}"style="font-size:12px;font-style:italic;color:#0000ff;font-weight:bold;" />

<apex:outputLabel value="{!Msg}" style="color:#ff0000;" id="msg" />

<apex:form >

<apex:selectRadio value="{!UserVote}" id="ResponsePanel" disabled="{!DisableOptions}">

 <apex:selectOptions value="{!ResponseOptions}" />

<apex:actionSupport event="onclick" action="{!SubmitVote}"rerender="ResponsePanel,msg,OutputResult" status="test" />

 </apex:selectRadio>

</apex:form>

<apex:actionStatus id="test" startText="submitting vote..." />

<apex:image width="200" height="150" url="{!ResponseUrl}"id="OutputResult" />

<apex:form >

<apex:commandLink action="{!showPastResults}"value="Past Results >>" />

</apex:form>

</apex:panelgrid>

</apex:pageBlock>

</apex:component>

  

Whenever the radio option is selected on the page, it shows error page with error as insufficient privilege.

I have removed all ther crud rights from the profile so that user could not get access to salesforce standard pages.

Please any one guide me on this issue.