• Bill Mc
  • NEWBIE
  • 0 Points
  • Member since 2014

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 9
    Questions
  • 13
    Replies
hi there

I have a simple APEX rest class with 2 methods: doGet() and doPost().  

When a POST request is made by a certain supplier platform the apex code cannot create Case records (error generated on Insert).  But when I call the same POST request using a test site like apitester.com it can!

But, when I config the supplier to make GET requests the code can create Case records.  Even though the User and Profile are the exact same for both requests.

Any ideas why a POST request from thuis supplier might be causing such an issue?  I have checked the HEADERs and PARAMs in both instancesd and they seem fine.

Any help appreciated

Bill










 
 am attempting to insert a Case object in response to a REST post request (its a web hook for a customer support chat service).

I can insert a custom object fine.

But when I try to insert a Case I get : UNKNOWN_EXCEPTION, invalid parameter value: [].

I have tried the exact same code outside of the REST Apex class and it works fine. 

All help appreciated.

Kind regards,  Bill

@RestResource(urlMapping='/test')
global class TestWebHook {
    @HttpGet
    global static String doGet() {
    }
    @HttpPost
    global static String doPost() {
        
        Case mycase = new Case();
        insert mycase;
    }
     
Hello.  I am attempting to uninstall a package with Apex classes.  

However, I get the message  "[Class name] is in use by a queued or in progress Apex Batch or Sharing Recalculation and cannot be deleted."  for many of the Apex classes in the package.

We dont have any in-progress or queued Apex jobs so I dont know where to turn now. 

Can anyone help?

Many thanks,  Bill
Hello.  I have an APEX class that is scheduled for execution every hour. It finds old cases and deletes them.  It has worked for over a year.

Recently, in the last few days, it has started to raise UNKNOWN_EXCEPTION on the line that deletes the cases.

Salesforce support ole me to raise the issue here since I do not have Prem support.

Can anyone help?

Kind regards,  Bill
Hello

I have a Scheduled Job that runs on the 1st of each month at 3am.  It runs under my user account.

I can see from the debug logs that the jobs runs but for some reason there is no code executed.  The Apex class works fine when I call it via the Developer Console.

The class is defined as:

global class WhizzOppRenewer implements Schedulable, Database.Batchable<sObject>, Database.Stateful   {

  global void execute(SchedulableContext sc) {
        RenewOpps();
    }

  public static void RenewOpps()
   {
.....Create and start batch job...
   }

The log from 3am today is below. 

The Code unit is started and ended right away and I cannot understand why.

Can anyone help?

Bill


UserBill MclaughlinDate01/03/2016 03:00:01 GMT
StatusSuccessApplicationUnknown
Request TypeApplicationOperationWhizzOppRenewer
Duration (ms)692,028,902Log Size (bytes)1,002
Log33.0 APEX_CODE,DEBUG;APEX_PROFILING,INFO;CALLOUT,INFO;DB,INFO;SYSTEM,DEBUG;VALIDATION,INFO;VISUALFORCE,INFO;WORKFLOW,INFO 03:00:00.732 (732751375)|EXECUTION_STARTED 03:00:00.732 (732797036)|CODE_UNIT_STARTED|[EXTERNAL]|01pD0000001MNeb|WhizzOppRenewer 03:00:00.734 (734487130)|CUMULATIVE_LIMIT_USAGE 03:00:00.734 (734487130)|LIMIT_USAGE_FOR_NS|(default)| Number of SOQL queries: 0 out of 100 Number of query rows: 0 out of 50000 Number of SOSL queries: 0 out of 20 Number of DML statements: 0 out of 150 Number of DML rows: 0 out of 10000 Maximum CPU time: 0 out of 10000 Maximum heap size: 0 out of 6000000 Number of callouts: 0 out of 100 Number of Email Invocations: 0 out of 10 Number of future calls: 0 out of 50 Number of queueable jobs added to the queue: 0 out of 50 Number of Mobile Apex push calls: 0 out of 10 03:00:00.734 (734487130)|CUMULATIVE_LIMIT_USAGE_END 03:00:00.732 (734539526)|CODE_UNIT_FINISHED|WhizzOppRenewer 03:00:00.732 (735775005)|EXECUTION_FINISHED
We have a scheduled APEX job which runs at 3am on the 1st day of each month.

I don't think the Job ran as expected this morning. Specifically I did not see any updates to our data, did not receive an email and do not see any evidence of it running in Setup-->Monitor-->Jobs-->Apex Jobs.

How should I proceed?
Hello. Currently when we approve Opportunities an Apex trigger creates custom Invoice objects with status = "Pending".

A trigger on this custom Invoice object checks for that status and if found makes a call to a future method (prefaced with "@future(callout=true)")  in another Apex class with the set of new Invoice objects.  This method then makes a callout to our external invoicing service for each of the new invoices.

The problem occurs at the start of each month when we approve approximately 50 new Opportunities. An exception is thrown at the point that the call to the external invoicing service: You have uncommitted work pending. Please commit or rollback before calling out.

My question is: why is this exception being raised when the callout is done within a method marked as @future?

Kind regards, Bill





 
Hello. I am attempting to query Task Objects using the WhatId from a list of Case objects.

I know these Cases have Tasks because if I use the case Id instead of the List<> notation (":cs" below) in the query it works fine.

But for some reason "Select Id from Task where WhatId IN :cs]" does not work

Can anyon help?  Code is below.


from Case where Subject='Thank you for contacting'
           And AccountId=null And ContactId=null and Status='New' order by Createddate asc LIMIT 10]);
      if(cs.size()>0)
      {
       List<Task> ts = new List<Task>([Select Id from Task where WhatId IN :cs]);
  /* WHY DOES THE ABOVE RETURN 0 ROWS?? */
    }
  • September 16, 2014
  • Like
  • 0
Hello everyone.  I have come upon an issue which is prohibiting our deployment of new components (even non-code items like templates) .

When we attempt to deploy a new changeset to production (even one without new APEX code) the system runs though our test cases as expected.  However, it replies with an error stating our code coverage is at 54% and thus cannot execute the deployment.  

However, when I run ALL Tests via the Developer Console and then use the Tooling API to retrieve the system wide code coverage (SELECT PercentCovered
FROM ApexOrgWideCoverage) it states 85%.  This apears correct to me when inspecting the coverage percentage by class and computing the total percentage.

My question is: Has anyone else encountered this issue and if so can they offer any advice as to how to resolve it?  

I have asked Salesforce for support by theu referred me here.

Kind regards, 

Bill McLaughlin
Hello.  I am attempting to uninstall a package with Apex classes.  

However, I get the message  "[Class name] is in use by a queued or in progress Apex Batch or Sharing Recalculation and cannot be deleted."  for many of the Apex classes in the package.

We dont have any in-progress or queued Apex jobs so I dont know where to turn now. 

Can anyone help?

Many thanks,  Bill
Hello.  I have an APEX class that is scheduled for execution every hour. It finds old cases and deletes them.  It has worked for over a year.

Recently, in the last few days, it has started to raise UNKNOWN_EXCEPTION on the line that deletes the cases.

Salesforce support ole me to raise the issue here since I do not have Prem support.

Can anyone help?

Kind regards,  Bill
Hello

I have a Scheduled Job that runs on the 1st of each month at 3am.  It runs under my user account.

I can see from the debug logs that the jobs runs but for some reason there is no code executed.  The Apex class works fine when I call it via the Developer Console.

The class is defined as:

global class WhizzOppRenewer implements Schedulable, Database.Batchable<sObject>, Database.Stateful   {

  global void execute(SchedulableContext sc) {
        RenewOpps();
    }

  public static void RenewOpps()
   {
.....Create and start batch job...
   }

The log from 3am today is below. 

The Code unit is started and ended right away and I cannot understand why.

Can anyone help?

Bill


UserBill MclaughlinDate01/03/2016 03:00:01 GMT
StatusSuccessApplicationUnknown
Request TypeApplicationOperationWhizzOppRenewer
Duration (ms)692,028,902Log Size (bytes)1,002
Log33.0 APEX_CODE,DEBUG;APEX_PROFILING,INFO;CALLOUT,INFO;DB,INFO;SYSTEM,DEBUG;VALIDATION,INFO;VISUALFORCE,INFO;WORKFLOW,INFO 03:00:00.732 (732751375)|EXECUTION_STARTED 03:00:00.732 (732797036)|CODE_UNIT_STARTED|[EXTERNAL]|01pD0000001MNeb|WhizzOppRenewer 03:00:00.734 (734487130)|CUMULATIVE_LIMIT_USAGE 03:00:00.734 (734487130)|LIMIT_USAGE_FOR_NS|(default)| Number of SOQL queries: 0 out of 100 Number of query rows: 0 out of 50000 Number of SOSL queries: 0 out of 20 Number of DML statements: 0 out of 150 Number of DML rows: 0 out of 10000 Maximum CPU time: 0 out of 10000 Maximum heap size: 0 out of 6000000 Number of callouts: 0 out of 100 Number of Email Invocations: 0 out of 10 Number of future calls: 0 out of 50 Number of queueable jobs added to the queue: 0 out of 50 Number of Mobile Apex push calls: 0 out of 10 03:00:00.734 (734487130)|CUMULATIVE_LIMIT_USAGE_END 03:00:00.732 (734539526)|CODE_UNIT_FINISHED|WhizzOppRenewer 03:00:00.732 (735775005)|EXECUTION_FINISHED
Hello. Currently when we approve Opportunities an Apex trigger creates custom Invoice objects with status = "Pending".

A trigger on this custom Invoice object checks for that status and if found makes a call to a future method (prefaced with "@future(callout=true)")  in another Apex class with the set of new Invoice objects.  This method then makes a callout to our external invoicing service for each of the new invoices.

The problem occurs at the start of each month when we approve approximately 50 new Opportunities. An exception is thrown at the point that the call to the external invoicing service: You have uncommitted work pending. Please commit or rollback before calling out.

My question is: why is this exception being raised when the callout is done within a method marked as @future?

Kind regards, Bill





 
Hello. I am attempting to query Task Objects using the WhatId from a list of Case objects.

I know these Cases have Tasks because if I use the case Id instead of the List<> notation (":cs" below) in the query it works fine.

But for some reason "Select Id from Task where WhatId IN :cs]" does not work

Can anyon help?  Code is below.


from Case where Subject='Thank you for contacting'
           And AccountId=null And ContactId=null and Status='New' order by Createddate asc LIMIT 10]);
      if(cs.size()>0)
      {
       List<Task> ts = new List<Task>([Select Id from Task where WhatId IN :cs]);
  /* WHY DOES THE ABOVE RETURN 0 ROWS?? */
    }
  • September 16, 2014
  • Like
  • 0
Hello everyone.  I have come upon an issue which is prohibiting our deployment of new components (even non-code items like templates) .

When we attempt to deploy a new changeset to production (even one without new APEX code) the system runs though our test cases as expected.  However, it replies with an error stating our code coverage is at 54% and thus cannot execute the deployment.  

However, when I run ALL Tests via the Developer Console and then use the Tooling API to retrieve the system wide code coverage (SELECT PercentCovered
FROM ApexOrgWideCoverage) it states 85%.  This apears correct to me when inspecting the coverage percentage by class and computing the total percentage.

My question is: Has anyone else encountered this issue and if so can they offer any advice as to how to resolve it?  

I have asked Salesforce for support by theu referred me here.

Kind regards, 

Bill McLaughlin

Hi All,

 

I am having really tough time dealing with Salesforce Test classes.

 

My first problem is when I write a test class, then the class I am testing does not show up in Overall Code Coverage.

 

Then when I click on test the class does show up in Class Code Coverage and show me the coverage % but when I click on it it opens without the colors telling me which line is covered and which is not.

 

 

Please let me know how to resolve this.

 

Thanks.