• Pritzl
  • NEWBIE
  • 0 Points
  • Member since 2008

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 3
    Questions
  • 4
    Replies
Not sure if this is the right forum for product improvement suggestions but here goes:

We are using web-to-case to generate cases for service from our clients. An Apex class was developped to match the account owner to the request based on a number of fields including the SuppliedEmail field. (suppliedEmail > contact > parent account > account owner) Unfortunately, because of the trigger/assignment precedence, the case still gets auto-assigned to the default case user even if we update the case owner field to reflect the retrieved id. To get around this we implemented a work-around that stores the account owner id within the case and send a notification email based on an after insert trigger to the account owner. They then have to log in and manually update the case owner id field to their own id.

The request is that we have more control over the auto-assignment of cases through any one of the following:

- Ideally, the autoassignment would only kick in if there was no case owner specified. i.e. if we update the case owner field using a before insert trigger, it would be nice if that was not later ignored and over-written by auto-assignment.

- Optionally, perhaps there would be an option that allows us to disable case auto-assignment completely.
  • February 22, 2008
  • Like
  • 0
Hello all. Still muddling about and hoping someone can point me in the right direction.

Summary:
I have set up a "before insert" trigger for cases generated through Web-to-Case. (different recordtype) It's purpose is to lookup the Account/ContactID based on a number of fields in the web form. (SuppliedCompany, SuppliedEmail, etc...) On successful lookup, we want to assign the case to the appropriate owner of the associated Account. Otherwise, the case gets assigned to a special queue set up to handle these "orphaned" cases.

Everything works fine at the trigger/Apex class level. I confirmed by sending myself an email with the retrieved values and checking the data objects with sForce Explorer. However, no matter what I do, I cannot get the case OwnerId value to "stick". It keeps getting reset to the Default Case User's Id or whatever User/Queue is specified in the Assignment rules. I'm not sure why this is so because based on the update sequence here: http://www.salesforce.com/us/developer/docs/apexcode/Content/apex_triggers_order_of_execution.htm
assignment rules are processed after all triggers. i.e. it seems that the assignment rules on our sandbox over-write the looked-up OwnerId value.


Code:
public class WebCaseLookup {

public static void Execute (Case[] webcases) {
for(Case acase:webcases) {
String accountId = '';
String contactId = '';
String ownerId;
Account[] a;
Contact[] c;

// look up the contact based on the supplied email address c = [select id, AccountId from Contact where email = :acase.SuppliedEmail]; if (c.size() == 1) { contactId = c[0].id; accountId = c[0].AccountId;
// now get the account's owner
ownerId = [select OwnerId from Account where id = :accountId][0].OwnerId; }
// otherwise, try matching the account on the name
else { a = [select id, OwnerId from Account where name = :acase.SuppliedCompany]; if (a.size() == 1) { accountId = a[0].id; ownerId = a[0].OwnerId; } } if (contactId != '') { acase.ContactId = contactId; } if (accountId != '') { acase.AccountId = accountId; acase.OwnerId = ownerId; } // jsut a test custom field to check that the update is actually working
acase.Greg_Test__c = 'UPDATED'; //just an email routine for debugging purposes
//Notify('APex Code results', 'Apex code ran successfully and found ContactId ('+contactId+'), AccountId ('+accountId+') and OwnerId ('+ownerId+')'); } } }

 

  • February 16, 2008
  • Like
  • 0
Hello,

We're having an issue with running Web-to-Case on our sandbox environment. Specifically, the servlet url (https://test.salesforce.com/servlet/servlet.WebToCase) keeps redirecting us to a login page once the form is submitted. Should we be using some alternate url or is this functionality completely disabled for sandbox accounts?
  • February 12, 2008
  • Like
  • 0
Not sure if this is the right forum for product improvement suggestions but here goes:

We are using web-to-case to generate cases for service from our clients. An Apex class was developped to match the account owner to the request based on a number of fields including the SuppliedEmail field. (suppliedEmail > contact > parent account > account owner) Unfortunately, because of the trigger/assignment precedence, the case still gets auto-assigned to the default case user even if we update the case owner field to reflect the retrieved id. To get around this we implemented a work-around that stores the account owner id within the case and send a notification email based on an after insert trigger to the account owner. They then have to log in and manually update the case owner id field to their own id.

The request is that we have more control over the auto-assignment of cases through any one of the following:

- Ideally, the autoassignment would only kick in if there was no case owner specified. i.e. if we update the case owner field using a before insert trigger, it would be nice if that was not later ignored and over-written by auto-assignment.

- Optionally, perhaps there would be an option that allows us to disable case auto-assignment completely.
  • February 22, 2008
  • Like
  • 0
Hello all. Still muddling about and hoping someone can point me in the right direction.

Summary:
I have set up a "before insert" trigger for cases generated through Web-to-Case. (different recordtype) It's purpose is to lookup the Account/ContactID based on a number of fields in the web form. (SuppliedCompany, SuppliedEmail, etc...) On successful lookup, we want to assign the case to the appropriate owner of the associated Account. Otherwise, the case gets assigned to a special queue set up to handle these "orphaned" cases.

Everything works fine at the trigger/Apex class level. I confirmed by sending myself an email with the retrieved values and checking the data objects with sForce Explorer. However, no matter what I do, I cannot get the case OwnerId value to "stick". It keeps getting reset to the Default Case User's Id or whatever User/Queue is specified in the Assignment rules. I'm not sure why this is so because based on the update sequence here: http://www.salesforce.com/us/developer/docs/apexcode/Content/apex_triggers_order_of_execution.htm
assignment rules are processed after all triggers. i.e. it seems that the assignment rules on our sandbox over-write the looked-up OwnerId value.


Code:
public class WebCaseLookup {

public static void Execute (Case[] webcases) {
for(Case acase:webcases) {
String accountId = '';
String contactId = '';
String ownerId;
Account[] a;
Contact[] c;

// look up the contact based on the supplied email address c = [select id, AccountId from Contact where email = :acase.SuppliedEmail]; if (c.size() == 1) { contactId = c[0].id; accountId = c[0].AccountId;
// now get the account's owner
ownerId = [select OwnerId from Account where id = :accountId][0].OwnerId; }
// otherwise, try matching the account on the name
else { a = [select id, OwnerId from Account where name = :acase.SuppliedCompany]; if (a.size() == 1) { accountId = a[0].id; ownerId = a[0].OwnerId; } } if (contactId != '') { acase.ContactId = contactId; } if (accountId != '') { acase.AccountId = accountId; acase.OwnerId = ownerId; } // jsut a test custom field to check that the update is actually working
acase.Greg_Test__c = 'UPDATED'; //just an email routine for debugging purposes
//Notify('APex Code results', 'Apex code ran successfully and found ContactId ('+contactId+'), AccountId ('+accountId+') and OwnerId ('+ownerId+')'); } } }

 

  • February 16, 2008
  • Like
  • 0
Hello,

We're having an issue with running Web-to-Case on our sandbox environment. Specifically, the servlet url (https://test.salesforce.com/servlet/servlet.WebToCase) keeps redirecting us to a login page once the form is submitted. Should we be using some alternate url or is this functionality completely disabled for sandbox accounts?
  • February 12, 2008
  • Like
  • 0