• Ramana V
  • NEWBIE
  • 20 Points
  • Member since 2019

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 4
    Questions
  • 2
    Replies
Hi All,
I have written following inbound email service for lead object.
global class LeadServices implements Messaging.InboundEmailHandler
{
    global Messaging.InboundEmailResult handleInboundEmail(Messaging.inboundEmail email, Messaging.InboundEnvelope env)
    {
        Messaging.InboundEmailResult result = new  Messaging.InboundEmailResult();
        string emailbody = email.plaintextbody;
        string emailsubject = email.subject;
        string subToCompare = emailsubject.Substring(emailsubject.indexof('ref :') + 5).trim();
        try
        {
            lead l = [SELECT
                Id, 
                Name, 
                Email
            FROM
                lead
            WHERE
                id  = : subToCompare];
            // Add a new Task to the lead record we just found above.
            Task newTask = new  Task();
            newTask.Description = emailbody;
            newTask.Priority = 'Normal';
            newTask.Status = 'Inbound Email';
            newTask.Subject = emailsubject;
            newTask.IsReminderSet = true;
            newTask.ReminderDateTime = System.now();
            newTask.WhoId = l.Id;
           
            Insert newTask;
        }
        catch(QueryException e)
        {
            System.debug('Issue: ' + e);
        }
        result.success = true;
        return result;
    }
}
I am have having 55% code coverage now.
Can someone please hepl me with test class for this?

Thanks in Advance

Regards,
Ramana
Hi All,
I am getting following error in javascript. Please help me with this error.
 
{!REQUIRESCRIPT("/soap/ajax/33.0/connection.js")}   
 
var newRecords = [];   
 
var coapp = new sforce.SObject("Lead");  
coapp.id ="{!Lead.Id}"; 
coapp.Name="{!Lead.Name}" 
coapp.Rating="Hot";             
 
newRecords.push(coapp); 
result = sforce.connection.update(newRecords); 
window.location.reload();

Error: The Name field is required.

Thanks in Advance
Hi All,
I want retrieve case records which from today to 2 years ago exactly. I have tried by using Last_N_DAYS:730. but it is giving even 2016 and before records also. I want only records between today and two years. Not before two years.
Can some please help me with SOQL query

Thanks in Advance!!

Regards,
Ramana
Hi All,
I have written a trigger to create record in price book entry when record is created in product. Now, I want to update the record in proce book entry which created due to this trigger.
Can some give me idea how to do this.

Thanks in advance
Hi All,
I want retrieve case records which from today to 2 years ago exactly. I have tried by using Last_N_DAYS:730. but it is giving even 2016 and before records also. I want only records between today and two years. Not before two years.
Can some please help me with SOQL query

Thanks in Advance!!

Regards,
Ramana