• Legerdemain
  • NEWBIE
  • 25 Points
  • Member since 2007

  • Chatter
    Feed
  • 1
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 14
    Replies
I'm just starting with the @future tag and added a future call to a Contact after insert trigger I've got. I added a call to a method which I plan to have geocode the Contact based on address, via a call out to google's geocoding service.

My method is very simple right now:
Code:
public class dataAugmentation { 
 @future
 public static void augmentAddresses(List<id> contactIdsToAugment) {
  List<Contact> ContactsToBeUpdated = new List<Contact>();
  for (Contact thisContact : [Select Id, OtherStreet,OtherCity,OtherState,OtherPostalCode,OtherCountry from Contact where Id IN :contactIdsToAugment]) { 
    thisContact.OtherCountry='Zanzibar';
    ContactsToBeUpdated.add(thisContact);
  
   //callout to web service
   //thisContactToAugment.Country='Zanzibar';
  }  
  update ContactsToBeUpdated;  
 }
}

 My code compiles and runs in the UI, but the future action (Country updated to 'Zanzibar') hasn't happened after an hour. When I try to modify the class that contains the future method, I get this error in the IDE:

Batchable class has jobs pending or in progress
dataAugmentation.cls
Winter 09 Preview/src/unpackaged/classes
line 1
Force.com save problem

I couldn't find any documentation about how future calls get batched and run, but if I had to interpret this error message I would guess that my updates are sitting in a queue waiting to run, and while that is happening, I can't modify the class.

Is that what is going on? Are there ways to monitor what future calls are waiting for execution?

Thanks,
Steve


Hi fellow developers,

I'm trying to emulate the sample in the vf dev guide (Adding Custom List Buttons using Standard List Controllers), but with a twist: using a detail from a master-detail (Account = Master, detail = Flavor_Request__c).

I have both the Apex Class and controller similar to the example in the dev guide:

Code:
public class OpptyFlavorListButton
{
    public OpptyFlavorListButton(ApexPages.StandardSetController controller) {
            controller.setPageSize(10);
    }
}

<apex:page standardController="Flavor_Request__c" recordSetVar="flavors"
    tabStyle="Flavor_Request__c" extensions="OpptyFlavorListButton">
<apex:form >
    <apex:pageBlock title="Edit Status" mode="edit">
        <apex:pageMessages />
        <apex:pageBlockButtons location="top">
            <apex:commandButton value="Save" action="{!save}"/>
            <apex:commandButton value="Cancel" action="{!cancel}"/>
        </apex:pageBlockButtons>

        <apex:pageBlockTable value="{!selected}" var="f">
            <apex:column value="{!f.name}"/>
            <apex:column value="{!f.Request_Type__c}"/>
            <apex:column value="{!f.Sample_Size__c}"/>
            <apex:column headerValue="Status">
                <apex:inputField value="{!f.Status__c}"/>
            </apex:column>
        </apex:pageBlockTable>
    </apex:pageBlock>
</apex:form>
</apex:page>

 



The buttons are added to the appropriate layouts, however, I keep getting the following errors:
1. Invalid variant 'parent': value 'Account'
2. Invalid variant 'parent': value 'Opportunity'

I get error #1 when trying this from the Account page (related list of flavors)
I get error #2 when trying this from the Opportunity page (related list of flavors)

I'm hitting these errors as the System Administrator who wrote the code...

Any feedback/suggestions would greatly be appreciated.

Thanks,
Larry


Message Edited by Legerdemain on 12-04-2008 08:38 PM

Message Edited by Legerdemain on 12-04-2008 08:39 PM

I have a requirement to integrate with an external web service using APEX web service callouts and providing a certificate for mutual authentication. Based on this link this is supported:

http://wiki.developerforce.com/index.php/Making_Authenticated_Web_Service_Callouts_Using_Two-Way_SSL

 

The security group, however, would like to have a single certificate across multiple sandboxes. They will only support CA-signed certificates and not Self signed certificates. Based on the fact that you need to generate the certificate request from each sandbox I do not see a way to support this 'single' certificate requirement.

 

Further more the sample certificate that they support is as follows:

 

DC=com, DC=highmark, OU=external, OU=people, UID=salesforceuser

 

The generated certificate request contains the following attributes and I do not see a way to input additional attributes based on the form provided:

 

C=US, ST=ST, L=City, O=Company, OU=external, CN=salesforceuser

  • January 28, 2011
  • Like
  • 0

Hi,

 

Does anyone know what this is about?  I'm trying to save a class that has an @future in it.  I've been working with it for many days and doing lots of different unit test scenarios.  I've been using a development org.

 

I've been able to save it before for all these days, but now I'm getting this error: "Batchable class has jobs pending or in progress" when I try to save it.  It's been in that state for at least an hour.

 

How long should these jobs pending usually take?  How long should I wait to do something about it .... and then what exactly would I then do??

 

Any help is appreciated!!

 

Thanks!!

I have a very simple Batch class and I am trying to write a unit test to cover it but the execute method in this batch class is never executing. I'm stumped.

 

Batch Class:

global class ideaCleanBatch implements Database.Batchable<sObject>{

global Database.QueryLocator start(Database.BatchableContext bc){
//We want to process all Ideas
return Database.getQueryLocator('select Id from Idea');
}

global void execute(Database.BatchableContext bc, List<sObject> objects){
Set<Id> ideaIds = new Set<Id>();
for(sObject s : objects){
Idea i = (Idea)s;
ideaIds.add(i.Id);
}
//Send ideas to ideaClean for processing
ideaClean.recalcNumbers(ideaIds);
}

global void finish(Database.BatchableContext bc){
system.debug('All done.');
}
}

Test Method:

static testMethod void ideaBatchTest(){
List<Idea> ideas = new List<Idea>();
Id communityId = [select Id from Community limit 1].Id;
for(Integer i = 0; i < 200; i++){
ideas.add(new Idea(Title = 'myIdea' + i, CommunityId = communityId));
}
insert ideas;

Test.startTest();
ideaCleanBatch job = new ideaCleanBatch();
ID batchprocessid = Database.executeBatch(job);
Test.stopTest();
}

Coverage:

 

Thanks,

Jason

 

  • October 30, 2009
  • Like
  • 0
I need to create PDFs dynamically. Basically a PDF template is provided which is kind of a form. Based on the data filled by the User, the form should be populated. The template will reside in Document library of Salesforce or Intranet. Is there a way to do it?

There are tools which allow PDF creation on fly like iText. But they are based on .Net or Java or Com/ActiveX platform. Can this be done within Salesforce.

I have already considered the option of generating the pdf using Visualforce. But it doesnt seems feasible because of huge number of different forms with each form consisting of more than 20 pages.

Hi

I've been trying to retrieve organization-wide default settings for each object type using the Force.com API (V.14.0) I first thought this would be possible using an SOQL query but there doesn't seem to be a Table holding information about the settings. Am I missing something or is it a know fact that you can't retrieve this information from salesforce?

Thanks
Martin
  • January 08, 2009
  • Like
  • 0
Hi fellow developers,

I'm trying to emulate the sample in the vf dev guide (Adding Custom List Buttons using Standard List Controllers), but with a twist: using a detail from a master-detail (Account = Master, detail = Flavor_Request__c).

I have both the Apex Class and controller similar to the example in the dev guide:

Code:
public class OpptyFlavorListButton
{
    public OpptyFlavorListButton(ApexPages.StandardSetController controller) {
            controller.setPageSize(10);
    }
}

<apex:page standardController="Flavor_Request__c" recordSetVar="flavors"
    tabStyle="Flavor_Request__c" extensions="OpptyFlavorListButton">
<apex:form >
    <apex:pageBlock title="Edit Status" mode="edit">
        <apex:pageMessages />
        <apex:pageBlockButtons location="top">
            <apex:commandButton value="Save" action="{!save}"/>
            <apex:commandButton value="Cancel" action="{!cancel}"/>
        </apex:pageBlockButtons>

        <apex:pageBlockTable value="{!selected}" var="f">
            <apex:column value="{!f.name}"/>
            <apex:column value="{!f.Request_Type__c}"/>
            <apex:column value="{!f.Sample_Size__c}"/>
            <apex:column headerValue="Status">
                <apex:inputField value="{!f.Status__c}"/>
            </apex:column>
        </apex:pageBlockTable>
    </apex:pageBlock>
</apex:form>
</apex:page>

 



The buttons are added to the appropriate layouts, however, I keep getting the following errors:
1. Invalid variant 'parent': value 'Account'
2. Invalid variant 'parent': value 'Opportunity'

I get error #1 when trying this from the Account page (related list of flavors)
I get error #2 when trying this from the Opportunity page (related list of flavors)

I'm hitting these errors as the System Administrator who wrote the code...

Any feedback/suggestions would greatly be appreciated.

Thanks,
Larry


Message Edited by Legerdemain on 12-04-2008 08:38 PM

Message Edited by Legerdemain on 12-04-2008 08:39 PM
I'm deploying a series of Apex classes using the Force.com Migration Tool (i.e. ANT). However, when I specify an explicit test class I get all errors for classes that already exist (the target instance is a sandbox), and have no bearing on the Apex classes I'm deploying. In short, it seems to be running all tests.
 
The classes I'm deploying aren't packaged, and neither are the existing classes which produce the errors.
 
Here's is my ANT task:
 
Code:
    <target name="deployWebSvcPkg">
      <sf:deploy username="${dest.username}" password="${dest.password}" serverurl="${dest.serverurl}" deployRoot="webSvcPkg">
        <runTest>WebSvcTest</runTest>
      </sf:deploy>
    </target>

 
Any ideas as to why these other (existing) classes end up being tested run I run the above task?
 
I'm just starting with the @future tag and added a future call to a Contact after insert trigger I've got. I added a call to a method which I plan to have geocode the Contact based on address, via a call out to google's geocoding service.

My method is very simple right now:
Code:
public class dataAugmentation { 
 @future
 public static void augmentAddresses(List<id> contactIdsToAugment) {
  List<Contact> ContactsToBeUpdated = new List<Contact>();
  for (Contact thisContact : [Select Id, OtherStreet,OtherCity,OtherState,OtherPostalCode,OtherCountry from Contact where Id IN :contactIdsToAugment]) { 
    thisContact.OtherCountry='Zanzibar';
    ContactsToBeUpdated.add(thisContact);
  
   //callout to web service
   //thisContactToAugment.Country='Zanzibar';
  }  
  update ContactsToBeUpdated;  
 }
}

 My code compiles and runs in the UI, but the future action (Country updated to 'Zanzibar') hasn't happened after an hour. When I try to modify the class that contains the future method, I get this error in the IDE:

Batchable class has jobs pending or in progress
dataAugmentation.cls
Winter 09 Preview/src/unpackaged/classes
line 1
Force.com save problem

I couldn't find any documentation about how future calls get batched and run, but if I had to interpret this error message I would guess that my updates are sitting in a queue waiting to run, and while that is happening, I can't modify the class.

Is that what is going on? Are there ways to monitor what future calls are waiting for execution?

Thanks,
Steve


Hi
I am using Eclipse IDE for salesforce trigger development. I have written a before insert trigger for Task object and inside that I want to find out the task is being created via SF ui or via API. I tried to use Trigger.isUi and Trigger.isApi methods but they won't compile.Is there and way to achieve this?
Whoohooo. I have finally built out a Visual Force page that is ready for prime time but now I need to write the test classes for it.

Here is my stumbling block:

The page is launched from a Page Button on the Lead object ( /apex/mergeLeadToOpp?id={!Lead.Id} )

In the controller the following query is run that uses "System.currentPageReference().getParameters().get('id')"

mylead = [select Id, Name, etc, etc from Lead where ID = :System.currentPageReference().getParameters().get('id')];

Here is my test class (not even close to done) but I can't seem to get it to work. Any help is greatly appreciated.
Code:
public class mergeLeadToOppVFTEST {

  public static testMethod void testMyController() {
    
    Lead l = new Lead(
     Reseller_First_Name__c = 'Jason',
      Reseller_Last_Name__c = 'V',
      Reseller_Email__c = 'jv@f5.com',
      Reseller_Company_Name__c = 'VenTech',
      Reseller_Phone__c = '207-69H-8540',
      Distributor__c = 'Super Disiti',
      Software_Vendor__c = 'SFDC',
      Source_code__c = 'abcd'
    );
    
    insert l;
    
    //I think this is where my problem is. Here is what I have tried but with no luck
    Test.setCurrentPageReference(new PageReference('/apex/mergeLeadToOpp—id=' + l.id));
    Test.setCurrentPageReference(new PageReference('Page.mergeLeadToOpp–id=' + l.id));
    Test.setCurrentPageReference(new PageReference('Page.mergeLeadToOpp')); 
       
    mergeLeadToOppVF controller = new mergeLeadToOppVF();
    
    controller.settargetOpp('asdfasd');
    controller.mergeLead();
    
    String error = controller.getError();
    System.AssertEquals(error,'Link or ID must be at least 15 characters long.');    
  }
}

 



Message Edited by TehNrd on 04-19-2008 10:12 PM
  • April 18, 2008
  • Like
  • 0
My code works like this. I have n number of Lead objects. When I click a checkbox I am trying to pass the value to a javascript function. It is not working. Any help. Also How do i achieve this functionality?

<apex:page controller="registerDomainController" tabStyle="Lead">
<script>
function addUsers(userid)
{
var idsToAdd = new Array();
alert('Before adding' + userid);
idsToAdd.add(userid);
}
</script>
<apex:sectionHeader title="Add User">
<apex:form>

<apex:pageBlock>
<apex:facet name="footer">

<apex:pageBlockSection title="Add Users to the Extranet">
<apex:dataTable value="{!allLeads}" var="user" cellspacing="0" cellpadding="4" border="0" width="800px">
<apex:column>
<apex:facet name="header">First Name</apex:facet>
<apex:outputText>{!user.firstname}</apex:outputText>
</apex:column>
<apex:column>
<apex:facet name="header">Last Name</apex:facet>
<apex:outputText>{!user.lastname}</apex:outputText>
</apex:column>
<apex:column>
<apex:facet name="header">Email Address</apex:facet>
<apex:outputText>{!user.email}</apex:outputText>
</apex:column>
<apex:column>
<apex:facet name="header">Phone number</apex:facet>
<apex:outputText>{!user.phone}</apex:outputText>
</apex:column>
<apex:column>
<apex:facet name="header">Add User</apex:facet>
<apex:inputCheckbox value="{!user.id}" onclick='addUsers({!user.id})'/>
</apex:column>

</apex:dataTable>

</apex:pageBlockSection>

</apex:pageBlock>
</apex:form>
</apex:sectionHeader>
</apex:page>
Hi

I've installed the Gneric SSO application into my developer SalesForce account. I can see the app. in my 'Installed Apps' list.

However when I try to follow the configuration information:

Code:
2/ Go to Setup|Company Profile|Company Information|SSO Gateway (URL) and put the URL as defined on this page 

 The SSO Gateway field doesn't appear under the Company Information.

Does anyone know why not?

Thanks

David
When you change a pricebook on an opportunity all products are deleted.

So you would think that any delete triggers on OpportunityLineItem would execute, but they do not.

Is this by design?
  • September 13, 2007
  • Like
  • 0