• Ek0nomik
  • NEWBIE
  • 125 Points
  • Member since 2011

  • Chatter
    Feed
  • 5
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 12
    Questions
  • 13
    Replies

I'm getting this error when updating objects via the partner API:

 

LIMIT_EXCEEDED: Cannot have more than 10 chunks in a single operation. Please rearrange the data to reduce chunking

 

In my case, I was updating Lead and Contact fields in the same call / operation.  Performing each type of operation separately fixed the problem in my case, however I'm hoping to understand what exactly this error means.  Is it some combination of sObject types and fields?

  • July 02, 2012
  • Like
  • 0

I was wondering if someone had any examples of how to use the ASP.NET Web API with the Salesforce Outbound Messages?  If not, does anyone at least have some information like if Salesforce does an HTTP POST to send the data?  

On the Contract object we have a related list of a custom object, let's just call it "CustomObject".  So if you visit the page layout for a contract record, you can see the related list of "CustomObjects".  I'm unable to do a SOQL relationship query on this custom object though.  I'm a little confused why I can query accounts and the related contracts, but I am unable to query contracts and the related custom objects.  I was hoping someone here could explain why this would be.

 

Thanks!

Using the API (i.e. SOQL), what is the fastest way to find all the child accounts from a specified account id?  Is my only option to query all accounts and their parents using something like:

 

SELECT Parent.ParentId, Parent.Parent.ParentId, Parent.Parent.Parent.ParentId, Parent.Parent.Parent.Parent.ParentId, Parent.Parent.Parent.Parent.Parent.ParentId FROM Account

 and then resursively iterate through the result set looking for accounts related to my specified account id?

I want to make sure I understand the time dependent workflows before I activate the rule I put in place.

 

The goal I am trying to achieve: automatically closing cases based on status, if it has not been modified in 14 days.

 

I have a workflow created with an evaluation criteria of "When a record is created, or when a record is edited and did not previously meet the rule criteria".  The rule criteria is looking for a particular status.  Then I have a field update within a time dependent workflow action which executes 14 days after the case last modified date.

 

Does this sound right?  Is this only going to be executed when a record is created or edited, as the evaluation criteria states?  Even if the record isn't edited, I would like this time dependent field update to kick in if the criteria is met.

I am using a custom e-mail template.  Every e-mail that gets sent with this template has a long series of underscores / underlines at the bottom of the e-mail.  This is not found anywhere in my HTML markup.  This is the markup automatically being apended to the markup in my template:

 

<br><br>_____________________________________________________________________<img src="http://cs4.salesforce.com/servlet/servlet.ImageServer?oid=RemovedRealId&amp;esid=RemovedRealId">

 How can I get rid of these underlines?

I'm new to the APEX development world, though I have quite a bit of experience using the API.  I feel like I'm very close to getting this to work, I just want to increase my test coverage of my trigger.  The trigger has two tasks:

 

1.  After the record has been inserted, a field should be updated

2.  Send an e-mail

 

The trigger is pretty simple:

 

trigger UpdateMostRecentCommentOnCase on CaseComment (after insert) {
	Case relatedCase;
	Contact relatedCaseContact;
	Messaging.Singleemailmessage customerEmail;
	
	for (CaseComment caseComment : trigger.new) {
		//Find the related case.
		relatedCase = [SELECT Id FROM Case WHERE Id = :caseComment.ParentId];
		
		//If the case was found, updated the most recent comment.
		if (relatedCase != null) {
			relatedCase.Most_Recent_Case_Comment__c = caseComment.CommentBody;
			update relatedCase;
			
			if (caseComment.IsPublished == true) {
				//Fetch the related case contact.
				relatedCaseContact = [SELECT Email FROM Contact WHERE Id = :relatedCase.ContactId];

				if (relatedCaseContact != null && relatedCaseContact.Email != null) {
					customerEmail = new Messaging.Singleemailmessage();
					customerEmail.setToAddresses(new List<String> { relatedCaseContact.Email });
					customerEmail.setReplyTo('foo@bar.com');
					customerEmail.setSubject('New comment for case ' + relatedCase.CaseNumber);
					customerEmail.setTemplateId('myActualIdIsHere');
					
					Messaging.sendEmail(new List<Messaging.Email> { customerEmail });
				}
			}	
		}
	}
}

 The test class that I have is very simple as well, though, I am not entirely sure how to test e-mails with the test methods:

 

@isTest
private class TestCase {
    static testMethod void testUpdateMostRecentCommentOnCase() {
        Case testCase;
        CaseComment testCaseComment;
        Contact testContact;
        Contact testQueriedContact;
        Messaging.Singleemailmessage testEmail;
        List<Messaging.Sendemailresult> testEmailResults;
        
        testContact = new Contact();
        testContact.FirstName = 'Foo';
        testContact.LastName = 'Bar';
        insert testContact;
        
        testCase = new Case();
        testCase.Subject = 'Test Case';
        testCase.ContactId = testContact.Id;
        insert testCase;
        
        test.startTest();
        
        testCaseComment = new CaseComment();
        testCaseComment.ParentId = testCase.Id;
        testCaseComment.CommentBody = 'Test Case Comment';
        insert testCaseComment;

        //What else do I need here to test?
        
        test.stopTest();
    }
}

 

This only puts me at 52% code coverage; everything after the comment, "//Fetch the related case contact." is not covered.

 

How do I provide coverage for the e-mail piece of the trigger?

 

Thanks for any input!

I am thinking I'm going to have to do a little hack to make this work, but, before I go down that path, I wanted to see if anyone here knew of a better solution to this.

 

I am trying to send an e-mail to the case contact when a new case comment is created.  I thought this was going to be easy, but, the related contact value of the recipient dropdown never has any available recipients.

 

Is my only option to create a workflow rule on Case Comments that updates some arbitrary field on the Case, and then have a workflow set up on the Case that just watches for a change in value on that arbitrary field?

 

Thanks for any input

I was wondering if anyone had an idea of how I could go about solving this problem.  I have two websites, but only one API user (I'm not going to pay a monthly fee for another user strictly for API usage).  I want to setup workflow e-mail alerts as follows:

 

1. When a case comment is created on Site A, send an e-mail to some e-mail address.

2. When a case comment is created on Site B, send an e-mail to some other e-mail address.

 

Does anyone have any ideas for how I could detect where the comment was created from?  Salesforce doesn't let you create any custom fields on comments, so that won't work.  I can't base it on who created the comment since it's always the same API user.  Do I have any worthwhile options here?

 

Thanks

I am executing the following query using the latest version (24) of the Salesforce API.  The query posted below has only had minor edits (renaming fields and objects).

 

 

select Id, Name, Type, Owner.Email, OwnerId, BillingStreet, BillingCity, BillingCountry, BillingState, BillingPostalCode, BillingAttn__c, Phone, ShippingStreet, ShippingCity, ShippingState, ShippingPostalCode, ShippingCountry, ShippingAttn__c,

(SELECT Id, ContractNumber, Contract_Code__c, StartDate, EndDate, Description, CreatedDate, ActivatedDate, LastModifiedDate, ContractTerm, Status FROM Contracts),

(SELECT Id, Name, CreatedDate, Contract_Code__c, Contract_Terms__c, Contract_Start_Date__c, Contract_End_Date__c, Status__c FROM Foo_Contract__r WHERE Status__c = 'Active' AND Contract_End_Date__c > 2012-05-22),

(SELECT Contract_Start_Date__c, Contract_End_Date__c, Name, Id, Status__c, Contract_Terms__c, Foo_Id__c, CreatedDate FROM Foo_Contract__r)

from Account where Id = 'xxx' ORDER BY CreatedDate DESC

 

When I execute the query I receieve the following:  MALFORMED_QUERY: SOQL retrieve statements cannot query related child data.  The call is being executed using the retrieve method in the API.

 

I have the following query:

 

SELECT Id, Name, (Select Id, LastName, FirstName, Email FROM Contacts WHERE Name LIKE '%Foo%')
FROM Account
WHERE Account.Name LIKE '%Bar%'

 

That returns records even where an account does not have any matching contacts.  I was reading the documentation on relationship queries, but I didn't find a way to achieve what I want from those docs.  Does anyone here know how I could do this?  I imagine there's an easy way to do it, but I'm still new to the SOQL world.

 

Thanks

Let's say I have two objects: Product Serial Numbers and Returns.

 

Product serial numbers are not required to have a return, because, the product may be operating absolutely fine.  But, when a return is created, there is a lookup to the product serial number so that the user will know what specific product had the issue so that it can be inspected, taken our of service, etc.

 

When I am querying a list of product serial numbers, am I able to pull in the optional return records that are associated with it?

I am trying to update an article type using the API, but anytime I try to update the save result contains an error which reads: "entity type cannot be updated: KBA".  The status code is: "CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY".  Is it not possible to update articles, or is this just a permission issue that I am overlooking?

On the Contract object we have a related list of a custom object, let's just call it "CustomObject".  So if you visit the page layout for a contract record, you can see the related list of "CustomObjects".  I'm unable to do a SOQL relationship query on this custom object though.  I'm a little confused why I can query accounts and the related contracts, but I am unable to query contracts and the related custom objects.  I was hoping someone here could explain why this would be.

 

Thanks!

I'm new to the APEX development world, though I have quite a bit of experience using the API.  I feel like I'm very close to getting this to work, I just want to increase my test coverage of my trigger.  The trigger has two tasks:

 

1.  After the record has been inserted, a field should be updated

2.  Send an e-mail

 

The trigger is pretty simple:

 

trigger UpdateMostRecentCommentOnCase on CaseComment (after insert) {
	Case relatedCase;
	Contact relatedCaseContact;
	Messaging.Singleemailmessage customerEmail;
	
	for (CaseComment caseComment : trigger.new) {
		//Find the related case.
		relatedCase = [SELECT Id FROM Case WHERE Id = :caseComment.ParentId];
		
		//If the case was found, updated the most recent comment.
		if (relatedCase != null) {
			relatedCase.Most_Recent_Case_Comment__c = caseComment.CommentBody;
			update relatedCase;
			
			if (caseComment.IsPublished == true) {
				//Fetch the related case contact.
				relatedCaseContact = [SELECT Email FROM Contact WHERE Id = :relatedCase.ContactId];

				if (relatedCaseContact != null && relatedCaseContact.Email != null) {
					customerEmail = new Messaging.Singleemailmessage();
					customerEmail.setToAddresses(new List<String> { relatedCaseContact.Email });
					customerEmail.setReplyTo('foo@bar.com');
					customerEmail.setSubject('New comment for case ' + relatedCase.CaseNumber);
					customerEmail.setTemplateId('myActualIdIsHere');
					
					Messaging.sendEmail(new List<Messaging.Email> { customerEmail });
				}
			}	
		}
	}
}

 The test class that I have is very simple as well, though, I am not entirely sure how to test e-mails with the test methods:

 

@isTest
private class TestCase {
    static testMethod void testUpdateMostRecentCommentOnCase() {
        Case testCase;
        CaseComment testCaseComment;
        Contact testContact;
        Contact testQueriedContact;
        Messaging.Singleemailmessage testEmail;
        List<Messaging.Sendemailresult> testEmailResults;
        
        testContact = new Contact();
        testContact.FirstName = 'Foo';
        testContact.LastName = 'Bar';
        insert testContact;
        
        testCase = new Case();
        testCase.Subject = 'Test Case';
        testCase.ContactId = testContact.Id;
        insert testCase;
        
        test.startTest();
        
        testCaseComment = new CaseComment();
        testCaseComment.ParentId = testCase.Id;
        testCaseComment.CommentBody = 'Test Case Comment';
        insert testCaseComment;

        //What else do I need here to test?
        
        test.stopTest();
    }
}

 

This only puts me at 52% code coverage; everything after the comment, "//Fetch the related case contact." is not covered.

 

How do I provide coverage for the e-mail piece of the trigger?

 

Thanks for any input!

I'm getting this error when updating objects via the partner API:

 

LIMIT_EXCEEDED: Cannot have more than 10 chunks in a single operation. Please rearrange the data to reduce chunking

 

In my case, I was updating Lead and Contact fields in the same call / operation.  Performing each type of operation separately fixed the problem in my case, however I'm hoping to understand what exactly this error means.  Is it some combination of sObject types and fields?

  • July 02, 2012
  • Like
  • 0

I am thinking I'm going to have to do a little hack to make this work, but, before I go down that path, I wanted to see if anyone here knew of a better solution to this.

 

I am trying to send an e-mail to the case contact when a new case comment is created.  I thought this was going to be easy, but, the related contact value of the recipient dropdown never has any available recipients.

 

Is my only option to create a workflow rule on Case Comments that updates some arbitrary field on the Case, and then have a workflow set up on the Case that just watches for a change in value on that arbitrary field?

 

Thanks for any input

I was wondering if anyone had an idea of how I could go about solving this problem.  I have two websites, but only one API user (I'm not going to pay a monthly fee for another user strictly for API usage).  I want to setup workflow e-mail alerts as follows:

 

1. When a case comment is created on Site A, send an e-mail to some e-mail address.

2. When a case comment is created on Site B, send an e-mail to some other e-mail address.

 

Does anyone have any ideas for how I could detect where the comment was created from?  Salesforce doesn't let you create any custom fields on comments, so that won't work.  I can't base it on who created the comment since it's always the same API user.  Do I have any worthwhile options here?

 

Thanks

I am executing the following query using the latest version (24) of the Salesforce API.  The query posted below has only had minor edits (renaming fields and objects).

 

 

select Id, Name, Type, Owner.Email, OwnerId, BillingStreet, BillingCity, BillingCountry, BillingState, BillingPostalCode, BillingAttn__c, Phone, ShippingStreet, ShippingCity, ShippingState, ShippingPostalCode, ShippingCountry, ShippingAttn__c,

(SELECT Id, ContractNumber, Contract_Code__c, StartDate, EndDate, Description, CreatedDate, ActivatedDate, LastModifiedDate, ContractTerm, Status FROM Contracts),

(SELECT Id, Name, CreatedDate, Contract_Code__c, Contract_Terms__c, Contract_Start_Date__c, Contract_End_Date__c, Status__c FROM Foo_Contract__r WHERE Status__c = 'Active' AND Contract_End_Date__c > 2012-05-22),

(SELECT Contract_Start_Date__c, Contract_End_Date__c, Name, Id, Status__c, Contract_Terms__c, Foo_Id__c, CreatedDate FROM Foo_Contract__r)

from Account where Id = 'xxx' ORDER BY CreatedDate DESC

 

When I execute the query I receieve the following:  MALFORMED_QUERY: SOQL retrieve statements cannot query related child data.  The call is being executed using the retrieve method in the API.

 

I have the following query:

 

SELECT Id, Name, (Select Id, LastName, FirstName, Email FROM Contacts WHERE Name LIKE '%Foo%')
FROM Account
WHERE Account.Name LIKE '%Bar%'

 

That returns records even where an account does not have any matching contacts.  I was reading the documentation on relationship queries, but I didn't find a way to achieve what I want from those docs.  Does anyone here know how I could do this?  I imagine there's an easy way to do it, but I'm still new to the SOQL world.

 

Thanks

Let's say I have two objects: Product Serial Numbers and Returns.

 

Product serial numbers are not required to have a return, because, the product may be operating absolutely fine.  But, when a return is created, there is a lookup to the product serial number so that the user will know what specific product had the issue so that it can be inspected, taken our of service, etc.

 

When I am querying a list of product serial numbers, am I able to pull in the optional return records that are associated with it?

I am trying to update an article type using the API, but anytime I try to update the save result contains an error which reads: "entity type cannot be updated: KBA".  The status code is: "CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY".  Is it not possible to update articles, or is this just a permission issue that I am overlooking?

Hi,

Am unable to refresh any of the resources in the IDE from the server.

When am trying to refresh a page from the web, getting an Exception saying:

 

 

Unable to refresh resource 'MileaeExension.cls':
com.salesforce.ide.api.metadata.types.Metadata$JaxbAccessorF_fullName cannot be cast to com.sun.xml.bind.v2.runtime.reflect.Accessor

 

Unable to refresh resource 'MileaeExension.cls':


com.salesforce.ide.api.metadata.types.Metadata$JaxbAccessorF_fullName cannot be cast to com.sun.xml.bind.v2.runtime.reflect.Accessor

 

Please assist to rectify the issue. 

 

Thanks in advance,

VNath