• mohan.sm
  • NEWBIE
  • 0 Points
  • Member since 2016

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 5
    Questions
  • 0
    Replies
Hi All,

When email to case is received. When the user reply the customer mail his user id should be set as case owner. How can we do this?


Thanks!!
Hi All,

I have email to case working where when an case is created via email, case owner is assigned to a Queue.
Now i want to bulid like if a user reply the case email he should become the owner of the case. 
How can we achieve this?

Thanks!!
Hi All,

Can some one help me with the test case for this trigger?
When an email to case is created it will search for contact based on email id and stamp the contact if found if not it will create a contact and stamp the value on case.


trigger TriggertoCreateContactformCase on Case (before insert) {
    List<String> UseremailAddresses = new List<String>();
    //First exclude any cases where the contact is set
    for (Case c:Trigger.new) {
        if (c.ContactId==null &&
            c.SuppliedEmail!=''|| c.SuppliedEmail==null)
        {
            UseremailAddresses.add(c.SuppliedEmail);
        }
    }

    //Now we have a nice list of all the email addresses.  Let's query on it and see how many contacts already exist.
    List<Contact> listofallContacts = [Select Id,Email From Contact Where Email in:UseremailAddresses];
    Set<String> ExstingEmails = new Set<String>();
    for (Contact c:listofallContacts) {
        ExstingEmails.add(c.Email);
    }
    
    Map<String,Contact> emailToContactMap = new Map<String,Contact>();
    List<Case> casesToUpdate = new List<Case>();

    for (Case c:Trigger.new) {
        if (c.ContactId==null &&
            c.SuppliedName!=null &&
            c.SuppliedEmail!=null &&
            c.SuppliedName!='' &&
           !c.SuppliedName.contains('@') &&
            c.SuppliedEmail!='' &&
           !ExstingEmails.contains(c.SuppliedEmail))
        {
            //The case was created with a null contact
            //Let's make a contact for it
            String[] Emailheader = c.SuppliedName.split(' ',2);
            if (Emailheader.size() == 2)
            {
                Contact conts = new Contact(FirstName=Emailheader[0],
                                            LastName=Emailheader[1],
                                            Email=c.SuppliedEmail
                                            );
                emailToContactMap.put(c.SuppliedEmail,conts);
                casesToUpdate.add(c);
            }
        }
    }
    
    List<Contact> newContacts = emailToContactMap.values();
    insert newContacts;
    
    for (Case c:casesToUpdate) {
        Contact newContact = emailToContactMap.get(c.SuppliedEmail);
        
        c.ContactId = newContact.Id;
    }
}


 
Hi Everyone,

I have a Button(Send__c) and a pick list field(Status__c) with values New, Modified, Submitted and Synced on Account Object.
1.On click of Button the Status should be set to submitted.
2. Button should be only active if the status is New or Modified else it should be inactive/grayed out.

Can someone pls help me with this requirement?
​Thanks!!
Hi Everyone,

I have a Button(Send__c) and a pick list field(Status__c) with values New, Modified, Submitted and Synced.

1.On click of Button the Status should be set to submitted.
2. Button should be only active if the status is New or Modified else it should be inactive/grayed out.

Can someone pls help me with this requirement?

Thanks!!