• Kevinp211
  • NEWBIE
  • 0 Points
  • Member since 2006

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

Hi,

 

I am encountering the following error when trying to invoke an approval process from a trigger. 

 

changeAmounts: execution of AfterUpdate caused by: System.DmlException: Process failed. First exception on row 0; first error: ALREADY_IN_PROCESS, Cannot submit object already in process.: Trigger.changeAmounts: line 11, column 41

 

Here is the trigger code. I have tried several variations always with the same result. I have confirmed there is not an active approval process for the record.

 

trigger changeAmounts on Opportunity (after update) { Opportunity opp; opp = Trigger.old[0]; if (Trigger.old[0].Amount <> Trigger.new[0].Amount) { Approval.ProcessSubmitRequest req1 = new Approval.ProcessSubmitRequest(); req1.setComments('Submitting request for approval.'); req1.setObjectId(opp.id); Approval.ProcessResult result1 = Approval.process(req1); } }


Any help is appreciated.


Thanks.

 

 

We are developing an SFDC API solution and have run into a problem when trying to query for solutions and filter by the solution category. We need to return the solutions and filter by the category in a single query call if possible or else use multiple queries very quickly.
 
Here are a couple of ones we tried but received an invalid field or invalid relationship exception.
 
binding.query("Select Id, SolutionName, SolutionNote from Solution where " & _
CategoryData.CategoryNodeId = "searchStringHere" LIMIT 100")
 
binding.query("Select Id, (Select CategoryNodeId From Categorydata where CategoryNodeId = "searchStringHere"), SolutionName, SolutionNote from Solution LIMIT 100")
 
Any help you can provide is appreciated.
Hello,
 
We are trying to create a custom S-control on a solution record that will fill in certain fields when selected. I created the following S-control but for some reason it does not work. No errors are given it simply displays the "Solution updating" message and nothing else happens. If I comment out the line in blue below the code will function and return to the original solution record but of course this does not update the solution.
 
Any help would be greatly appreciated. Thanks!
 
 
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
 <head>
  <title>Update Field</title>
  <script src="https://www.salesforce.com/services/lib/ajax/beta3.3/sforceclient.js?browser=false" type="text/javascript"></script>
  <script language="javascript">
<!--
//Page initialization
function initPage() {
 
sforceClient.registerInitCallback(pageSetup);
sforceClient.setLoginUrl("https://test.salesforce.com/services/Soap/u/7.0");
sforceClient.init("{!API_Session_ID}", "{!API_Partner_Server_URL_70}", true);
}
 
function goBack(Id) {
 // This brings me back to the Objects overview page if an Object Id is given.
 var r = "{!Scontrol_URL}".split(/salesforce.com/);
 var whichId = "";
 if (Id != null) whichId = Id;
 var returnUrl = r[0] + "salesforce.com/"+whichId;
 window.parent.parent.location.href = returnUrl;
}
function pageSetup() {
 
var myCase = new Sforce.Dynabean("Solution");
myCase.set("Id", "Solution_ID");
myCase.set("Solution_SolutionNote","Test Solution Template");
sforceClient.Update(myCase);
goBack("{!Solution_ID}");
}
//-->
  </script>
 </head>
 <body onload="initPage();">
       Solution Updating......
    </body>
</html>