-
ChatterFeed
-
0Best Answers
-
0Likes Received
-
1Likes Given
-
5Questions
-
8Replies
two identical strings not equaling true when compared
I have two strings I copied one and saved it into a different field and I have some code that compares the two to see if they match.
The issue is that my apex says they do not match.
Here is the code I tried:
if(r.subject__c == null || r.subject__c.equals(processedCase.subject)) matchSubject = True; //this was not returning true so I tried if(r.subject__c == null || r.subject__c == processedCase.subject)) matchSubject=True //Didn't work also tried r.subject__c.compareto(processedCase.subject) //answer was 51
The strings are not null, I have debugged them out at run time. I suspect it is some of the characters in the strings that are not being handled correctly. The string is in the format of
"XX | SOME | Text(sometext) | a\string-with-dash-and-backslashes | _underscore"
- Malakai Lavi
- January 07, 2016
- Like
- 0
- Continue reading or reply
two strings are the same but == true and string1.compareto(true) returns false.
I have two strings I copied one and saved it into a different field and I have some code that compares the two to see if they match.
The issue is that my apex says they do not match.
Here is the code I tried:
The issue is that my apex says they do not match.
Here is the code I tried:
if(r.subject__c == null || r.subject__c.equals(processedCase.subject)) matchSubject = True; //this was not returning true so I tried if(r.subject__c == null || r.subject__c == processedCase.subject)) matchSubject=True //Didn't work also tried r.subject__c.compareto(processedCase.subject) //answer was 51 //The strings are not null, I have debugged them out at run time. I suspect it is some of the characters in the strings that are not being handled correctly. The string is in the format of "XX | SOME | Text(sometext) | a\string-with-dash-and-backslashes | _underscore"
- Malakai Lavi
- January 07, 2016
- Like
- 0
- Continue reading or reply
Like a chatter post
I wrote a chatter bot that creates a feed item when a certain action takes place.
I want to write code that will "like" certain posts when they are posted.
I would like to do this using an apex class. What is the code that adds a "like" to a feed post?
I want to write code that will "like" certain posts when they are posted.
I would like to do this using an apex class. What is the code that adds a "like" to a feed post?
- Malakai Lavi
- October 11, 2014
- Like
- 0
- Continue reading or reply
Delay a chatter post
I want to write a chatter bot for a demo that posts after a certain set of conditions. Eg, a task is created and 30 seconds later the chatter bot makes a post on the task.
Is it possible to delay that post so that it does not occur immediatlely within the context of the transaction?
Is it possible to delay that post so that it does not occur immediatlely within the context of the transaction?
- Malakai Lavi
- October 09, 2014
- Like
- 0
- Continue reading or reply
Send EMail exception- INVALID_FIELD_WHEN_USING_TEMPLATE
I have some code in a class that is called by a triffer that sends emails. I am intermittently receiving exceptions when the code is called. The exceptions only happen about 10% of the time or less (Making it very difficult to set up debug logging for a number of users to try and perhaps catch when the exception occurs). I can't work out what is causing the exception as the error message does not make sense in context of the code.
Exception caused by: System.EmailException: SendEmail failed. First exception on row 0; first error: INVALID_FIELD_WHEN_USING_TEMPLATE, When a template is specified the plain text body, html body, subject and charset may not be specified : []
The code on the line specified in the exception:
//Add emails to the list of emails to be sent
Messaging.SingleEmailMessage message = new Messaging.SingleEmailMessage();
message.setOrgWideEmailAddressId(emailAddress.Id);
message.setTargetObjectId(c.ContactId);
message.setWhatId(c.Id);
message.setTemplateId(inttemplate.Id);
messages.add(message);
}
Messaging.sendEmail(messages);
Clearly it doesn't specify plain text body, html body, subject or charset.
Exception caused by: System.EmailException: SendEmail failed. First exception on row 0; first error: INVALID_FIELD_WHEN_USING_TEMPLATE, When a template is specified the plain text body, html body, subject and charset may not be specified : []
The code on the line specified in the exception:
//Add emails to the list of emails to be sent
Messaging.SingleEmailMessage message = new Messaging.SingleEmailMessage();
message.setOrgWideEmailAddressId(emailAddress.Id);
message.setTargetObjectId(c.ContactId);
message.setWhatId(c.Id);
message.setTemplateId(inttemplate.Id);
messages.add(message);
}
Messaging.sendEmail(messages);
Clearly it doesn't specify plain text body, html body, subject or charset.
- Malakai Lavi
- June 26, 2014
- Like
- 0
- Continue reading or reply
two identical strings not equaling true when compared
I have two strings I copied one and saved it into a different field and I have some code that compares the two to see if they match.
The issue is that my apex says they do not match.
Here is the code I tried:
if(r.subject__c == null || r.subject__c.equals(processedCase.subject)) matchSubject = True; //this was not returning true so I tried if(r.subject__c == null || r.subject__c == processedCase.subject)) matchSubject=True //Didn't work also tried r.subject__c.compareto(processedCase.subject) //answer was 51
The strings are not null, I have debugged them out at run time. I suspect it is some of the characters in the strings that are not being handled correctly. The string is in the format of
"XX | SOME | Text(sometext) | a\string-with-dash-and-backslashes | _underscore"
- Malakai Lavi
- January 07, 2016
- Like
- 0
- Continue reading or reply
Like a chatter post
I wrote a chatter bot that creates a feed item when a certain action takes place.
I want to write code that will "like" certain posts when they are posted.
I would like to do this using an apex class. What is the code that adds a "like" to a feed post?
I want to write code that will "like" certain posts when they are posted.
I would like to do this using an apex class. What is the code that adds a "like" to a feed post?
- Malakai Lavi
- October 11, 2014
- Like
- 0
- Continue reading or reply
Delay a chatter post
I want to write a chatter bot for a demo that posts after a certain set of conditions. Eg, a task is created and 30 seconds later the chatter bot makes a post on the task.
Is it possible to delay that post so that it does not occur immediatlely within the context of the transaction?
Is it possible to delay that post so that it does not occur immediatlely within the context of the transaction?
- Malakai Lavi
- October 09, 2014
- Like
- 0
- Continue reading or reply
Send EMail exception- INVALID_FIELD_WHEN_USING_TEMPLATE
I have some code in a class that is called by a triffer that sends emails. I am intermittently receiving exceptions when the code is called. The exceptions only happen about 10% of the time or less (Making it very difficult to set up debug logging for a number of users to try and perhaps catch when the exception occurs). I can't work out what is causing the exception as the error message does not make sense in context of the code.
Exception caused by: System.EmailException: SendEmail failed. First exception on row 0; first error: INVALID_FIELD_WHEN_USING_TEMPLATE, When a template is specified the plain text body, html body, subject and charset may not be specified : []
The code on the line specified in the exception:
//Add emails to the list of emails to be sent
Messaging.SingleEmailMessage message = new Messaging.SingleEmailMessage();
message.setOrgWideEmailAddressId(emailAddress.Id);
message.setTargetObjectId(c.ContactId);
message.setWhatId(c.Id);
message.setTemplateId(inttemplate.Id);
messages.add(message);
}
Messaging.sendEmail(messages);
Clearly it doesn't specify plain text body, html body, subject or charset.
Exception caused by: System.EmailException: SendEmail failed. First exception on row 0; first error: INVALID_FIELD_WHEN_USING_TEMPLATE, When a template is specified the plain text body, html body, subject and charset may not be specified : []
The code on the line specified in the exception:
//Add emails to the list of emails to be sent
Messaging.SingleEmailMessage message = new Messaging.SingleEmailMessage();
message.setOrgWideEmailAddressId(emailAddress.Id);
message.setTargetObjectId(c.ContactId);
message.setWhatId(c.Id);
message.setTemplateId(inttemplate.Id);
messages.add(message);
}
Messaging.sendEmail(messages);
Clearly it doesn't specify plain text body, html body, subject or charset.
- Malakai Lavi
- June 26, 2014
- Like
- 0
- Continue reading or reply
- Ajju
- June 25, 2014
- Like
- 2
- Continue reading or reply