3

We have many products that we support. Each of these products have a queue within SFDC that have cases submitted to it via EMail2Case.

At the moment cases come through via email with significant detail missing, for obvious reasons... it is from an email. However the email address the clients send through to is product specific e.g. [email protected], [email protected]. Therefore we understand which product the client is requesting support for by the address they send to.

So, I am trying to work out if there is any way to automatically add the Product into the case?

2 Answers 2

1

(Splitting original answer with two options into separate answers upon request by @Saariko to allow targeted feedback)

Prerequisite: custom field on Case that is lookup to Product2 (product__c)

Option 2 - Use an after insert trigger on Case

  • After insert is required because ownerId won't be known until after the Case is inserted
  • Within the after insert trigger, if the ownerId is a queue (starts with '00G'), then you can get the queue name by querying the Group SObject (type='Queue')
  • Then, in the after insert trigger, you need to xref the queue name to a Product2. I probably would put a custom field on Product2 called associated_queue_name__c and use a trigger on Product2 to verify it is unique across all Product2 and referred to a real Queue (Group) - or, you could rely on your own iron-fisted administration .
  • Finally, the after insert trigger would do DML to update the Case with the id of the Product2 record found by the xref
1

(Splitting original answer with two options into separate answers upon request by @Saariko to allow targeted feedback)

Prerequisite: - custom field on Case that is lookup to Product2 (product__c)

Option 1 - Use workflows on Case (on create)

  • The Case Owner (a queue) can be interrogated in the workflow criteria and then you can use field updates to set the Product__c field. This will require hard-coding ids in your formula fields and field updates - use plenty of comments! Note an ownerId is a queue if it starts with '00G'. Difficult to deploy if the Products and queues are first created in sandbox as their Ids won't port asis to PROD.

One arguable "plus" to this approach is you can deploy directly into PROD and be done in less than 1 hour if you are the 'gunslinging' kind of sysad. Personally, I find it very distasteful to hardcode IDs into any formula/URL hack and if I do so, it will be very heavily commented.

2
  • Thanks for the suggestion crop1645. I will push it through to our team and see if it sticks.
    – TravisPUK
    Mar 12, 2014 at 9:35
  • Crop, do you mind splitting your answer to 2 answers? I think each of them might get it's pros and cons better. ^^
    – Saariko
    Mar 12, 2014 at 9:39

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .