• Thomas Orozco
  • NEWBIE
  • 0 Points
  • Member since 2012

  • Chatter
    Feed
  • 0
    Best Answers
  • 2
    Likes Received
  • 0
    Likes Given
  • 2
    Questions
  • 6
    Replies

Hello everyone,

 

We are trying to use the new API Salesforce made available during Winter '13: Test.setMock.

We followed the documentation, but encountered the following issue that we were unable to resolve: a System.CalloutException, complaining that we had "uncommitted work pending".

 

Of course we do, our testmethod starts by setting up some Test Data that's necessary for the test to work, and that includes inserting and updating data.

In an actual execution, there would be no data creation, as the data would already be present. Actually doing the callout doesn't raise the Uncomitted work pending exception, so the Test Data really is at fault.

 

We did use Test.startTest() and Test.stopTest() to differentiate Test Data creation from Test Execution but this (as expected) didn't work.

We also tried some hacks, including the System.runAs(new User( Id = UserInfo.getUserId()){} that had, in the past, allowed us to circumvent "Mixed DML operations". This didn't work either.

 

We considered using the Test.loadData method, but we're inserting related objects and couldn't figure out a clean enough way to make it work (maybe we should try using ExternalID's?).

 

 

For the moment, our workaround is to modify the class generated from the WSDL, adding a if (Test.isRunningTest()) {} else {}, but that means we have to modify the autogenerated code, which is suboptimal.

 

 

Did anyone try to use this new API and run into the same issue? How did you solve it?

Hi,

I want to have two Apex plugins to use in the Cloud Flow designer with a fair bunch of shared functionnality.
Inheritance therefore comes to mind.

Here's what I did:

global virtual class PluginA implements Process.Plugin {
    // Some_Code...
}

global class PluginB extends PluginA {
    // Some_Code...
}


When I go to the Visual Workflow Cloud Designer, PluginA shows up, but PluginB doesn't.


Why is that? Did I go wrong somewhere? 
Is there a way to make this work with inheritance (I could always create another class that implements the functionnality and call it from my Plugins, but that's sub-optimal). 


Thanks in advance,

Thomas

Hello everyone,

 

We are trying to use the new API Salesforce made available during Winter '13: Test.setMock.

We followed the documentation, but encountered the following issue that we were unable to resolve: a System.CalloutException, complaining that we had "uncommitted work pending".

 

Of course we do, our testmethod starts by setting up some Test Data that's necessary for the test to work, and that includes inserting and updating data.

In an actual execution, there would be no data creation, as the data would already be present. Actually doing the callout doesn't raise the Uncomitted work pending exception, so the Test Data really is at fault.

 

We did use Test.startTest() and Test.stopTest() to differentiate Test Data creation from Test Execution but this (as expected) didn't work.

We also tried some hacks, including the System.runAs(new User( Id = UserInfo.getUserId()){} that had, in the past, allowed us to circumvent "Mixed DML operations". This didn't work either.

 

We considered using the Test.loadData method, but we're inserting related objects and couldn't figure out a clean enough way to make it work (maybe we should try using ExternalID's?).

 

 

For the moment, our workaround is to modify the class generated from the WSDL, adding a if (Test.isRunningTest()) {} else {}, but that means we have to modify the autogenerated code, which is suboptimal.

 

 

Did anyone try to use this new API and run into the same issue? How did you solve it?

Hello everyone,

 

We are trying to use the new API Salesforce made available during Winter '13: Test.setMock.

We followed the documentation, but encountered the following issue that we were unable to resolve: a System.CalloutException, complaining that we had "uncommitted work pending".

 

Of course we do, our testmethod starts by setting up some Test Data that's necessary for the test to work, and that includes inserting and updating data.

In an actual execution, there would be no data creation, as the data would already be present. Actually doing the callout doesn't raise the Uncomitted work pending exception, so the Test Data really is at fault.

 

We did use Test.startTest() and Test.stopTest() to differentiate Test Data creation from Test Execution but this (as expected) didn't work.

We also tried some hacks, including the System.runAs(new User( Id = UserInfo.getUserId()){} that had, in the past, allowed us to circumvent "Mixed DML operations". This didn't work either.

 

We considered using the Test.loadData method, but we're inserting related objects and couldn't figure out a clean enough way to make it work (maybe we should try using ExternalID's?).

 

 

For the moment, our workaround is to modify the class generated from the WSDL, adding a if (Test.isRunningTest()) {} else {}, but that means we have to modify the autogenerated code, which is suboptimal.

 

 

Did anyone try to use this new API and run into the same issue? How did you solve it?

Hi,

I want to have two Apex plugins to use in the Cloud Flow designer with a fair bunch of shared functionnality.
Inheritance therefore comes to mind.

Here's what I did:

global virtual class PluginA implements Process.Plugin {
    // Some_Code...
}

global class PluginB extends PluginA {
    // Some_Code...
}


When I go to the Visual Workflow Cloud Designer, PluginA shows up, but PluginB doesn't.


Why is that? Did I go wrong somewhere? 
Is there a way to make this work with inheritance (I could always create another class that implements the functionnality and call it from my Plugins, but that's sub-optimal). 


Thanks in advance,

Thomas