• Erica Cox
  • NEWBIE
  • 0 Points
  • Member since 2014

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 1
    Likes Given
  • 11
    Questions
  • 3
    Replies
I am deploying a flow with the ant migration tool. I have deployed this same flow with ant before, but am now getting the error: 'The ContactType is invalid. Provide the API name of an object.' The data type of the field that is throwing the error is SObject. I am running as Sys Admin, so Apex access isn't the issue.
When running all tests in production environment, test failures are occuring in 4 of 99 test classes with error of Apex CPU time limit exceeded. These test classes run successfully when run singly, and there was a successful deployment a few days ago in which all tests were run. The last change set was backed out by running only selected tests, but still can't run all tests. Users are also experiencing CPU time limit errors. There have been nosubstantial changes to the org or data that we can determine. Has anyone come across something similar?
This scheduled job works when scheduled singly, but when scheduled nightly causes an exception: INVALID_FIELD_FOR_INSERT_UPDATE, cannot specify Id in an insert call: [Id].  The insert is outside of the for loop, which is what would ordinarily cause that exception.
global class QuarterlyReminderLogic implements Schedulable
{
    // This class will be scheduled to run daily. Use this string in the anon apex call
    // String CRON_EXP = '0 0 0 * * ?';
    private List<Task> newTasks = new List<Task>();
    
    // The execute function of the class is what will be invoked daily
    global void execute(SchedulableContext SC)
    {          
        List<Individual__c> inds = [SELECT Id, First_Name__c, Last_Name__c, 
                                  Assigned_User__c, Last_Quarterly_Visit__c, 
                                  Days_Since_Last_Qrtly_Visit__c
                                  FROM Individual__c WHERE  Last_Quarterly_Visit__c != null
                              		And Days_Since_Last_Qrtly_Visit__c in (60, 76, 83)];
        for(Individual__c ind : inds)
        {
            // 7 days out
            if (ind.Days_Since_Last_Qrtly_Visit__c == 83) {
				processTask(ind, 7);                                
            // 14 days out
            } else if (ind.Days_Since_Last_Qrtly_Visit__c == 76) {
                processTask(ind, 14);
            // 30 days out
            } else if (ind.Days_Since_Last_Qrtly_Visit__c == 60) {
                processTask(ind, 30);
            }
			
        }
        if (newTasks.size() > 0) {
            insert newTasks;
        }
    }
    
    // Give assigned User a new Task
    public void processTask(Individual__c ind, Integer days)
    {
        Task t = new Task();
        String t_description = 'Test task.'; 
        t.Description = t_description;
        t.OwnerId = ind.Assigned_User__c;  
        if (days == 30 || days == 14) {
            t.Priority = 'Normal';
        } else if (days == 7) {
            t.Priority = 'High';
            sendPmEmail(ind);
        }
        String subject_line = 'Quarterly activity due';
        t.Subject = subject_line;
        t.WhatId = ind.Id;
        t.ActivityDate = date.today();
        System.debug('Inserting task: '+t);
        newTasks.add(t);
    }
         
}

 
Suddenly all users are getting an Insufficient Privileges error when trying to access a VF page in our org. Even sys admins. The page hasn't changed, the controller hasn't changed, all profiles still have access to the page and controller, and all static resources referred to in the page are accounted for. Nothing in the setup audit trail since yesterday when things were running normally.
I have a scheduled job that runs and finishes when I schedule a single occurance. And worked for a long time as a weekly job. It has stopped working when scheduled weekly. The Scheduled Job list shows that it was scheduled for execution, but with the changes to the Apex Job list, all I can see there is that it is queued.  When I try to do a trace it seems like the debug log is cut off mid query.  No error.  Is there a way to debug this that I am missing, or do I need to change it to call a batch job in order to see what is happening?
The home page for our app (custom VF) sometimes churns for over 15 minutes without loading.  If the user refreshes the page, it loads immediately.  This has just been reported in the last few weeks, despite no changes to the page.
I have the need to disable the buttons on a page if a particular subtab is open in a certain state, as indicated in the URL of the subtab.  The code below works sometimes, but only if that tab happens to be last in the list.  The return statement here doesn't break the loop, because it just returns from the callback. Tried setting a var in the for loop and doing the disable code after the loop if the var was true, but but that doesn't work because getPageInfo is asynchronous. 
var evalSubTabIdsCallback = function (result) {
         	if(result.ids != null) {
         		var arrTabIds = result.ids;
         		var arrLength = arrTabIds.length;         		
         		
         		for(var i = 0; i <arrLength ; i++) {
         			var tabId = arrTabIds[i];
         			sforce.console.getPageInfo(tabId,function(pageInfoResult){         				
         				var JSONObj = JSON.parse(pageInfoResult.pageInfo);         				
         				var url=JSONObj["url"];
         				if( url.indexOf('addingFromCase=true') > 0 )  { 
						    buttonsEnabled(false);
        					gIsScreenDisabled = true;
        					return;        						     						
        				
        				} else {
							buttonsEnabled(true);
        					gIsScreenDisabled = false;         					      				
         				}         					
         			});    			         			
         		}        
         	}
         	  
         };
        
         var focusedCaseTabListener = function (result) {
         	var primaryTabId = null;
                sforce.console.getSubtabIds(primaryTabId , valSubTabIdsCallback);                 

         };
 
 
For the last 24+ hours, users in my org have reported a myriad of errors, ranging from 'Unable to Process Request - We apologize for the inconvenience' to 'common.util.database.ConnectionPoolTimeoutException', to 'common.exception.ServerTooBusException: Too many requests waiting for connection.'  It would seem like a problem with the instance.  But, accordingly to trust, everything is fine.  I have checked the Setup Audit Trail and nothing has changed in our org.  I have logged a case, but is there anything else that I can do to resolve this? 
I have the need to search for contacts with a match on last name, first name, birthdate, phone, or a number of custom fields.  The code is currently building a string for SOSL call that looks, in part, like this:
 
String sosl = 'FIND \' TestLast OR TestFirst OR (111) 222-3333 OR 2004-12-07\'
               IN ALL FIELDS RETURNING Contact ( id, firstname, lastname, phone, birthdate)';

List<List<SObject>> searchList = search.query(sosl);

The list returned only includes matches on firstname, lastname, and phone -- not on birthdate.  Are date fields searchable in SOSL?  Perhaps I am misunderstanding the documentation when it lists the follwing as a limitation of SOSL :  

--Number, date, or checkbox fields. To search for such information, use the query() call instead.

Since I am using query() I thought I was OK, but maybe not?


 
Is there a way to display the line breaks that a user enters in the body of a Notes object? This is a custom VF page, in which the text input code is:
<apex:inputTextArea value="{!newCaseConsultationNote.note.body}" 
                                            label="Note Body" styleClass="noteTextArea" />
and the output code:
<apex:outputPanel layout="block" styleClass="noteBodyStyle">
      <apex:outputText value="{!ccNote.note.body}" /> 
</apex:outputPanel>
The style classes are very basic:
.noteBodyStyle {
        margin-left:15px;
        font-size: 95%;
    }  
   
    .noteTextArea {
        width:75%;
        height:30px;
The problem is that when the user enters the following:

Item1
Item2

The result is:

Item1 Item2


My client is migrating to SF from a legacy system.  We need to migrate about 200K files into ContentVersion.  I have started using DataLoader and a csv file as described in the SF documentation, with about 10K records per file, but it is going REALLY slowly,  Also, the DataLoader will occasionally error out on me for various reaons and I'm havng trouble opening the success files.  Anyone out there had to do something similar and have any tips for me?
Suddenly all users are getting an Insufficient Privileges error when trying to access a VF page in our org. Even sys admins. The page hasn't changed, the controller hasn't changed, all profiles still have access to the page and controller, and all static resources referred to in the page are accounted for. Nothing in the setup audit trail since yesterday when things were running normally.
My client is migrating to SF from a legacy system.  We need to migrate about 200K files into ContentVersion.  I have started using DataLoader and a csv file as described in the SF documentation, with about 10K records per file, but it is going REALLY slowly,  Also, the DataLoader will occasionally error out on me for various reaons and I'm havng trouble opening the success files.  Anyone out there had to do something similar and have any tips for me?
Hi,

I am having a problem that I investigated down to this very simple minimalistic example that can be reproduced easily.

1) Create a workflow rule on the Account object that will send an email to the sales team when an account is created

2) Create a Unit Test like this:

static testMethod void Test_TestWS() {
     Account customer = new Account( Name = 'A' );
     INSERT customer;
 
      Test.startTest();
      Test.setMock(HttpCalloutMock.class, new UTest_Mock_HttpResponseGenerator());

       MyClass.CallWebService(customer.Id);
      Test.stopTest();
}

When executing the unit test I get this:
   System.CalloutException: You have uncommitted work pending. Please commit or rollback before calling out

What is the best practice to avoid this problem. I am following all guidelines in order to Mock my web service and to make sure that startTest is called AFTER my test data is inserted.

It looks like the workflow rule has some pending update in the DB that is not comitted on the startTest which causes the problem.

If I Deactivate the workflow rule, my test runs fine.

Thanks

Hugo

Can anyone suggest, how ca we delete apex class from production.

please provide step-step process to delete it from prod. through Force.com Eclipse.

  • October 29, 2010
  • Like
  • 1