• Malakai Lavi
  • NEWBIE
  • 25 Points
  • Member since 2014

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 1
    Likes Given
  • 5
    Questions
  • 8
    Replies

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"
 
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"

 
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 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?
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.

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"
 
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 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?
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.