• kailash chandra 25
  • NEWBIE
  • 30 Points
  • Member since 2019
  • Mr
  • Webkul Software Pvt. Ltd.

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 4
    Questions
  • 4
    Replies
I want to display lightning wysiwyg editor in lightning component while object fields is textarea(long) and object is salesforce standard object which can't be alter.
I want to send email through custom object  

List<Messaging.SingleEmailMessage> allmsg = new List<Messaging.SingleEmailMessage>();
        EmailTemplate emailSickEmpTemplate = [Select Id from EmailTemplate where developername = 'Email_with_list_of_sick_employees'];
        Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();
        mail.setTemplateID(emailSickEmpTemplate.Id); 
        mail.setTargetObjectId(Userinfo.getUserId());
        mail.setSaveAsActivity(false);
        mail.setOrgWideEmailAddressId(owa.id);
        allmsg.add(mail);
        Messaging.sendEmail(allmsg,false);

This is the exception:

|SendEmail failed. First exception on row 0; first error: INVALID_TYPE_FOR_OPERATION, Only User, Contact, Lead, or Person objects are allowed for targetObjectId: a020v000002n3sr.: [targetObjectId, a020v000002n3srAAA]
Using apex how can i differentiate between standard object and custom object?
I have an Id Type of object that might be either a standard object or custom object.
I want to get records of contact based on Birthdate.
eg: i need to display contact records in ASC order of next 60 days. so how to use GROUP BY CALENDAR_MONTH(Birthdate) ASC .
If I use GROUP BY Birthdate ASC It will return date in ascending order.

I am trying SOQL query like this
select id, name,PhotoUrl,Birthdate from Contact WHERE Birthdate != null AND Birthdate = NEXT_N_DAYS:60 ORDER BY CALENDAR_MONTH(Birthdate) ASC, DAY_IN_MONTH(Birthdate) ASC LIMIT 5 OFFSET 0

[object Object]: Ordered field cannot be aggregated in a query that is not grouped: CALENDAR_MONTH(Birthdate)

I need this solution through SOQL without using apex
Do you have any solution to sort birthdate based on month and date then please help me
I want to display lightning wysiwyg editor in lightning component while object fields is textarea(long) and object is salesforce standard object which can't be alter.
I want to send email through custom object  

List<Messaging.SingleEmailMessage> allmsg = new List<Messaging.SingleEmailMessage>();
        EmailTemplate emailSickEmpTemplate = [Select Id from EmailTemplate where developername = 'Email_with_list_of_sick_employees'];
        Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();
        mail.setTemplateID(emailSickEmpTemplate.Id); 
        mail.setTargetObjectId(Userinfo.getUserId());
        mail.setSaveAsActivity(false);
        mail.setOrgWideEmailAddressId(owa.id);
        allmsg.add(mail);
        Messaging.sendEmail(allmsg,false);

This is the exception:

|SendEmail failed. First exception on row 0; first error: INVALID_TYPE_FOR_OPERATION, Only User, Contact, Lead, or Person objects are allowed for targetObjectId: a020v000002n3sr.: [targetObjectId, a020v000002n3srAAA]
I want to get records of contact based on Birthdate.
eg: i need to display contact records in ASC order of next 60 days. so how to use GROUP BY CALENDAR_MONTH(Birthdate) ASC .
If I use GROUP BY Birthdate ASC It will return date in ascending order.

I am trying SOQL query like this
select id, name,PhotoUrl,Birthdate from Contact WHERE Birthdate != null AND Birthdate = NEXT_N_DAYS:60 ORDER BY CALENDAR_MONTH(Birthdate) ASC, DAY_IN_MONTH(Birthdate) ASC LIMIT 5 OFFSET 0

[object Object]: Ordered field cannot be aggregated in a query that is not grouped: CALENDAR_MONTH(Birthdate)

I need this solution through SOQL without using apex
Do you have any solution to sort birthdate based on month and date then please help me