• MG Consulting
  • NEWBIE
  • 75 Points
  • Member since 2008

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

Hi,

 

I can't get Type.forName to work for Managed Custom Objects. I have no issue getting it to work for Unmanaged Custom Objects. I've tried all sorts of different combinations of calls to Type.forName and I'm thoroughly stumped :(  Help please!

 

Thanks a lot,

Mike

Hi,

 

I've been unable to execute Apex unit tests for the the past couple of hours

 

I'm getting Organization Administration Locked errors, it looks like this issue may be specific to my org. It seems that a race condition or something of that nature, has occurred that has left my org stuck locked for the past couple of hours.

 

I've logged Case # 07112508 for this issue.

 

Any help you can provide would be greatly appreciated as I'd love to get back to writing code as soon as possible.

 

Thanks a lot,

Mike

Hi,

 

I've got a batch job that works well in manual testing, processing multiple records in each batch without any issues. However my unit test fails if I set the scope greater than just 1 record with a "System.UnexpectedException: Error processing messages". I'm stumped, does anyone know what this cryptic exception means?

 

Thanks a lot,

Mike

Hi All,

 

How do I permanently hide/ignore files/folders in Force.com IDE's Synchronize tab?

 

Thanks a lot,

Mike

 

Cluttered Force.com IDE Synchronize Tab

It seems to me the RecordTypeInfo should be updated to return the Record Type Label and the Developer Name. I remember back a few versions ago when they updated Record Types to have a Developer Name and they updated the database object so you can query for it but they didn't update the describe call. Would be nice to have it there as well since it hits different limits and just for convenience. Makes no sense for it not to be there and it is confusing because it just says name and since it is actually the label now I think it will break some code when translations are enabled.

Hi,

 

From New Spring '10 Apex Dev Guide: 

"Single email messages sent with the sendEmail method count against the sending organization's daily single email limit. When this limit is reached, calls to the sendEmail method using SingleEmailMessage are rejected, and the user receives a SINGLE_EMAIL_LIMIT_EXCEEDED error code. However, single emails sent through the application are allowed."

 

 

  1. If I select a User as the setTargetObjectId does it still count against these limits?
  2. What is the actual daily max # of single emails by org type?

 

Thanks in advance for you help,

Mike 

Hi,

 

I need to use escape="false" in some of our app's Visualforce pages in order to allow the display of HTML stored in the database. Per SFDC's Security Review of our app (and for good reason), I must sanitize this HTML. Unfortunately, SFDC does not yet provide any built-in methods to do so, therefore, one must roll their own solution.

 

Any ideas on the best way to go about implementing this?

 

Thanks a lot,

Mike 

Hi,

I just received the Salesforce.com ISV Partner Program Partner Success Survey and I can't seem to find a good explanation of the difference between Joint Customers and Joint Subscribers anywhere. The survey simply states the following:

* Note: Joint customers are those companies or organizations subscribing to a partner's Force.com OEM or AppExchange application.
 
Please provide a little more detail and, even better, an example to go along with it.
 
More specifically to my particular situation, if I only currently offer a free app, do all of the production organizations that have my free app installed count as joint customers, joint subscribers or neither? 
 
Thanks a lot,
Mike

Hi,

 

We've been experiencing Intermittent Maintenance Page(500/503) errors on our Sites.

We do not receive an Apex Exception email and, in my experience, Apex Exceptions result in Authorization Required Page (401) and not Maintenance Page(500/503). Therefore, this doesn't seem to be related to a bug in our code and is quite possibly an issue on SFDC's side. We can't see any pattern to these errors, so far as we can tell they are random. They are obviously hard to reproduce on demand due to their intermittent nature.

 

Clearly, this problem is very troubling to us so any help would be greatly appreciated.

 

Thanks a lot,

Mike 

Hi,

 

I'm creating a Visualforce page for Sys Admins on which I would like be able to display a drop down of all Sites in the org if possible. From what I can tell, the Sites info is stored in the metadata but, unfortunately, it doesn't seem like there is a way to access this particular metadata from Apex.

 

Any ideas?

 

Thanks a lot,

Mike 

Hi,

 

When I try to pass the following custom apex class to a custom component via the attribute's assignTo I get an internal server error (Error ID: 461678711-978 (887763395)). I'm pretty sure this has to do with trying to pass it an SObjectField.

 

I need to pass the component either a FieldDescribeResult or an SObjectField in order to avoid hitting governor limits with fields.getMap() calls.

 

Any ideas?

 

 

public class StandardQuestionObj {

public StandardQuestionObj(StandardQuestion__c sObj, SObjectField sObjField) {
this.SObj = sObj;
this.SObjField = sObjField;
}

public StandardQuestion__c SObj { get; set; }
public SObjectField SObjField { get; set; }
}

 

<apex:component id="standardQuestionComponent" controller="StandardQuestionController">
<apex:attribute name="standardQuestionObj" description="The Standard Question Object." type="StandardQuestionObj" required="true" assignTo="{!StdQuestionObj}"/>

...

</apex:component>

 

 

Thanks a lot,

Mike

 

Hi,

 

Quick question, the answer to which I am guessing is currently no but someday yes:

 

<apex:inputField value="{!Contact.Name}"/> <!-- Static -->

 

<apex:inputField value="{!Contact.get('Name')}"/> <!-- Dynamic -->

 

Is there anyway currently to do something like the Dynamic example above, so that the field my be varied at runtime?

 

It would certainly make my life a whole lot easier... 

 

Thanks a lot,

Mike 

Hi,

I can't access a custom component's attribute value from it's controller's constructor. Below is a simple test case that demostrates the problem:
 

<apex:page showHeader="false"> <c:Scratch testAttr="Test Value"/></apex:page>

 

<apex:component controller="Scratch"> <apex:attribute name="testAttr" description="test desc" type="String" assignTo="{!TestProp}"/> <div> <apex:outputText value="testAttr: {!testAttr}"/> </div> <div> <apex:outputText value="TestProp: {!TestProp}"/> </div></apex:component>

 

 

public class Scratch { public Scratch() { System.debug('TEST_PROP: ' + TestProp); } public String TestProp { get; set; } }

 

As you can see the outputText for both testAttr & TestProp correctly dislpay "Test Value" but the System.debug message shows TestProp's value as being null.
 
Anyone know what's going on here?
 
Thanks a lot,
Mike

Hi,

 

Does anyone know under what circumstances a custom component's controller would be instainated twice? This custom component only appears once on the page. I have other custom components who's constructors only get instainated once as expected.

 

I have tried to root cause it by creating a blank custom component/controller combo and adding suspect functionality to it one by one, but have been unsuccessful thus far. 

 

Thanks,

Mike

Hi,

 

I can't seem to figure out where one would use the message component. Error message display is built into the inputField component so no need for it there.

 

The only place I can possibly see it being used is in conjunction with the other input components such as inputText. But, the only message it seems it can display in those cases is the required field message that uses the long, user unfriendly id of the inputText component. This makes this message kind of useless, so in the past I've baked my own required validation for these components using global error messages.

 

I can't help but get the feeling I'm missing something here.

 

Could someone please shed some light on this for me and provide some valid usages of the message component?

 

Thanks a lot,

Mike 

Hi,

 

I have inputText components along side inputField components in a form and thus I would like to be able to display errors associated with inputText components next to them via the message component. Right now, I am forced to display them in the messages component at the bottom of the form. This is awkard, and not ideal, because if an inputField has an error it displays next to it and if an inputText has an error it displays it at the bottom of the form.

 

 

It seems the only error you can get to display in the message component for an inputText is the standard required message by setting required equal to true.

 

 

Is there anyway to add custom error messages associated with a specific inputText component like I can with inputFields?

 

 

Thanks a lot,

Mike 

Hi,

 

I checked off "Insert spaces for tabs" under Preferences, General, Editors, Text Editors. It replaces tabs I create with 4 spaces which is great. Unfortunately, it doesn't turn the tabs generated by the automatic indenting into 4 spaces.

 

Anyone know how to make this happen?

 

Thanks a lot,

Mike 

Hi,

 

I'm only counting 5 SOQL queries in the code below and yet I received the error below. So far as I can tell, none of my 5 queries are in a loop, so I can't figure out how they could possible execute 21 times before hitting the first one...

 

I'm guessing that maybe the context of the governor limits are larger then the trigger itself, but I really have no idea what is going on...

 

NewEmailMessage: execution of BeforeUpdate

caused by: System.Exception: Too many SOQL queries: 21

Trigger.NewEmailMessage: line 12, column 42

 

trigger NewEmailMessage on Case (before update) {
Set<Id> caseIds = new Set<Id>();
for (Case c: Trigger.new) {
if (c.NewEmailMessage__c == true) {
caseIds.add(c.Id);
c.NewEmailMessage__c = false;
}
}

if (caseIds.size() != 0) {
Set<Id> taskIds = new Set<Id>();
for (EmailMessage emailMessage : [SELECT ActivityId
FROM EmailMessage
WHERE ParentId IN :caseIds]) {
taskIds.add(emailMessage.ActivityId);
}

Map<Id, Task> tasks = new Map<Id, Task>([SELECT Id
FROM Task
WHERE Id IN :taskIds]);

String[] fromAddresses = new String[]{};
for (EmailMessage emailMessage : [SELECT FromAddress
FROM EmailMessage
WHERE Incoming = true
AND ActivityId IN :tasks.keySet()]) {
if (emailMessage.FromAddress != null)
fromAddresses.add(emailMessage.FromAddress);
}

Map<String, Id> emailContactId = new Map<String, Id>();
if (fromAddresses.size() != 0) {
for(Contact contact : [SELECT Id, Email
FROM Contact
WHERE Email IN :fromAddresses
ORDER BY CreatedDate DESC]) {
if (contact.Email != null)
emailContactId.put(contact.Email, contact.Id);
}
}

CaseCommentExtension__c[] caseCommentExtensions = new CaseCommentExtension__c[]{};
for (EmailMessage emailMessage : [SELECT ParentId,
Incoming,
FromAddress,
FromName,
ToAddress,
CcAddress,
BccAddress,
Subject,
TextBody
FROM EmailMessage
WHERE ActivityId IN :tasks.keySet()]) {
CaseCommentExtension__c caseCommentExtension = new CaseCommentExtension__c();
caseCommentExtension.ParentId__c = emailMessage.ParentId;
caseCommentExtension.IsPublished__c = true;
caseCommentExtension.Tier__c = 'Customer';

if (emailMessage.Incoming == true) {
caseCommentExtension.Type__c = 'Inbound E-mail';

if (emailContactId.containsKey(emailMessage.FromAddress))
caseCommentExtension.Contact__c = emailContactId.get(emailMessage.FromAddress);
}
else
caseCommentExtension.Type__c = 'Outbound E-mail';
caseCommentExtension.Subject__c = emailMessage.Subject;

String commentBody = '';
if (emailMessage.FromAddress != null)
commentBody += 'From Address: ' + emailMessage.FromAddress + '\n';
if (emailMessage.FromName != null)
commentBody += 'From Name: ' + emailMessage.FromName + '\n';
if (emailMessage.ToAddress != null)
commentBody += 'To Address: ' + emailMessage.ToAddress + '\n';
if (emailMessage.CcAddress != null)
commentBody += 'CC Address: ' + emailMessage.CcAddress + '\n';
if (emailMessage.BccAddress != null)
commentBody += 'BCC Address: ' + emailMessage.BccAddress + '\n';
if (emailMessage.TextBody != null)
commentBody += 'Text Body:\n' + emailMessage.TextBody;
caseCommentExtension.CommentBody__c = commentBody;

Trigger.newMap.get(emailMessage.ParentId).NewestComment__c = commentBody;

caseCommentExtensions.add(caseCommentExtension);
}

delete tasks.values();
insert caseCommentExtensions;
}
}

 

Thanks for the help,

Mike

 

 

Hi,

 

I'm converting an old unmanaged package into a new managed packaged and I am running into an issue. I have an S-Control named Checklist_New, shown here:

<html>
<head>
<script type="text/javascript" language="javascript" src="/soap/ajax/9.0/connection.js"></script>
<script type="text/javascript" language="javascript">
<!--
function init() {
// Call the 'new checklist' page and set the save URL to our custom populate SControl.
// Always set the return URL to the checklist view page.
// Request.CF00N70000001aCWA contains entity name, if called from the entity
if ('{!$Request.CF00N70000001aCWA}' != '') {
window.parent.location.href = "{!URLFOR($Action.Checklist__c.New, null, [CF00N70000001aCWA=$Request.CF00N70000001aCWA, saveURL=URLFOR($SControl.Checklist_Populate, null, [retURL=URLFOR($Request.retURL, null, null, true)]), retURL=URLFOR($Request.retURL, null, null, true)], true)}";
} else {
window.parent.location.href = "{!URLFOR($Action.Checklist__c.New, null, [saveURL=URLFOR($SControl.Checklist_Populate, null, [retURL=URLFOR($Request.retURL, null, null, true)]), retURL=URLFOR($Request.retURL, null, null, true)], true)}";
}
}
// -->
</script>
</head>

<body onLoad="init()">
<p>&nbsp;</p>
</body>

</html>

 

 When I attempt to upload my package I get the following error:

Component Type Name Problem
Custom S-Control Checklist New This component depends on another component that is not included in this package.

 If I remove this S-Control from my package the upload is sucessful, but clearly this is not an option.

 

The S-Control Checklist_Populate and the Object  Checklist__c are both included in the package by Checklist_New.

 

I can't seem to think of anything else it could possible be dependant on so I'm thinking something quirky is going on here...

 

Any ideas?

 

Thanks a lot,

Mike

 

 

 

Hi,

 

Does anyone know what the "WSC SOAP stack" is?

 

 

Context: I'm working on customizing the Email-to-Case Agent and I've figured out that they switched from using Axis to the "WSC SOAP Stack". I now understand that this is why there is no SObject.get_any() method. The problem is, I don't know what SOAP implmentation they are refering to when they say "WSC SOAP stack" so I have been unable to locate the documentation for it. Specifically, I'm not sure how one accesses a field of an SObject via the Partner WSDL with it.

 

 

Thanks a lot,

Mike 

Hi Everyone,

the addError() method which you can use in an Apex Trigger alsways escapes the error message when used in SF1 or Lightning. Has anyone experienced the same and has a solution or should we contact Salesforce with a bug report?

Thanks,

Sten  

 

Wondering if anyone has experienced this issue and has a solution or workaround to get responsive email templates working with Salesforce email templates.

I use an application to build responsive emails, which provides all the html with inline css . When I send a test with with the application or a third party service, it gets delivered with no layout anomalies.
However, when I past the code into a "Custom" Salesforce email template, save it, and send a test, the layout is all distorted on mobile devices. I am guessing Salesforce is ignoring or removing some of the inline CSS. 

Any suggestions to this issue?

Hi,

 

I can't get Type.forName to work for Managed Custom Objects. I have no issue getting it to work for Unmanaged Custom Objects. I've tried all sorts of different combinations of calls to Type.forName and I'm thoroughly stumped :(  Help please!

 

Thanks a lot,

Mike

Hi,

 

I've been unable to execute Apex unit tests for the the past couple of hours

 

I'm getting Organization Administration Locked errors, it looks like this issue may be specific to my org. It seems that a race condition or something of that nature, has occurred that has left my org stuck locked for the past couple of hours.

 

I've logged Case # 07112508 for this issue.

 

Any help you can provide would be greatly appreciated as I'd love to get back to writing code as soon as possible.

 

Thanks a lot,

Mike

Hi,

 

I've got a batch job that works well in manual testing, processing multiple records in each batch without any issues. However my unit test fails if I set the scope greater than just 1 record with a "System.UnexpectedException: Error processing messages". I'm stumped, does anyone know what this cryptic exception means?

 

Thanks a lot,

Mike

Hi,

 

I need to use escape="false" in some of our app's Visualforce pages in order to allow the display of HTML stored in the database. Per SFDC's Security Review of our app (and for good reason), I must sanitize this HTML. Unfortunately, SFDC does not yet provide any built-in methods to do so, therefore, one must roll their own solution.

 

Any ideas on the best way to go about implementing this?

 

Thanks a lot,

Mike 

 

The Outbound Message contains a SessionId and a ServerURL, Is it possible  to use this SessionId and ServerURL to access Salesforce and avoid login/authentication?

 

Thanks

Jon

 

Hi,

 

I'm creating a Visualforce page for Sys Admins on which I would like be able to display a drop down of all Sites in the org if possible. From what I can tell, the Sites info is stored in the metadata but, unfortunately, it doesn't seem like there is a way to access this particular metadata from Apex.

 

Any ideas?

 

Thanks a lot,

Mike 

I am using the Pattern and Matcher classes to search text from an email.  Sometimes, I get an exception that says Regex too complicated.  I can't find any information on this.  Does anyone know what can cause?  I get the premise of the exception but don't know what to do to fix it.  If I put my regular expression and sample text into the tester on this site, http://www.fileformat.info/tool/regex.htm.  It works fine and returns what I want.  From what I understand Salesforce uses similar functionality as Java which the above site is using.  Any ideas?  Thanks.

Hi,

 

When I try to pass the following custom apex class to a custom component via the attribute's assignTo I get an internal server error (Error ID: 461678711-978 (887763395)). I'm pretty sure this has to do with trying to pass it an SObjectField.

 

I need to pass the component either a FieldDescribeResult or an SObjectField in order to avoid hitting governor limits with fields.getMap() calls.

 

Any ideas?

 

 

public class StandardQuestionObj {

public StandardQuestionObj(StandardQuestion__c sObj, SObjectField sObjField) {
this.SObj = sObj;
this.SObjField = sObjField;
}

public StandardQuestion__c SObj { get; set; }
public SObjectField SObjField { get; set; }
}

 

<apex:component id="standardQuestionComponent" controller="StandardQuestionController">
<apex:attribute name="standardQuestionObj" description="The Standard Question Object." type="StandardQuestionObj" required="true" assignTo="{!StdQuestionObj}"/>

...

</apex:component>

 

 

Thanks a lot,

Mike

 

Hi,

 

Quick question, the answer to which I am guessing is currently no but someday yes:

 

<apex:inputField value="{!Contact.Name}"/> <!-- Static -->

 

<apex:inputField value="{!Contact.get('Name')}"/> <!-- Dynamic -->

 

Is there anyway currently to do something like the Dynamic example above, so that the field my be varied at runtime?

 

It would certainly make my life a whole lot easier... 

 

Thanks a lot,

Mike 

Hi,

I can't access a custom component's attribute value from it's controller's constructor. Below is a simple test case that demostrates the problem:
 

<apex:page showHeader="false"> <c:Scratch testAttr="Test Value"/></apex:page>

 

<apex:component controller="Scratch"> <apex:attribute name="testAttr" description="test desc" type="String" assignTo="{!TestProp}"/> <div> <apex:outputText value="testAttr: {!testAttr}"/> </div> <div> <apex:outputText value="TestProp: {!TestProp}"/> </div></apex:component>

 

 

public class Scratch { public Scratch() { System.debug('TEST_PROP: ' + TestProp); } public String TestProp { get; set; } }

 

As you can see the outputText for both testAttr & TestProp correctly dislpay "Test Value" but the System.debug message shows TestProp's value as being null.
 
Anyone know what's going on here?
 
Thanks a lot,
Mike

Hi,

 

Does anyone know under what circumstances a custom component's controller would be instainated twice? This custom component only appears once on the page. I have other custom components who's constructors only get instainated once as expected.

 

I have tried to root cause it by creating a blank custom component/controller combo and adding suspect functionality to it one by one, but have been unsuccessful thus far. 

 

Thanks,

Mike

Hi,

 

I have inputText components along side inputField components in a form and thus I would like to be able to display errors associated with inputText components next to them via the message component. Right now, I am forced to display them in the messages component at the bottom of the form. This is awkard, and not ideal, because if an inputField has an error it displays next to it and if an inputText has an error it displays it at the bottom of the form.

 

 

It seems the only error you can get to display in the message component for an inputText is the standard required message by setting required equal to true.

 

 

Is there anyway to add custom error messages associated with a specific inputText component like I can with inputFields?

 

 

Thanks a lot,

Mike