• mbshick
  • NEWBIE
  • 0 Points
  • Member since 2009

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 2
    Questions
  • 1
    Replies

We use EmailToCase and are looking to enhance it a bit. Each account has a specific technical consultant assigned to it and they are supposed to handle Tier 1 support for the account, so we would like the case to be owned by them as soon as it is submitted. It seems that the only way of accomplishing this is via an Apex trigger, which I've been trying to write for the past couple of days. I've successfully written one previously and this one seems conceptually simple, but there seem to be some nuances that I'm just not getting. My rudimentary stab at it currently looks like this:

 

trigger AssignTechnicalConsultantToCase on Case (before insert) {
	for (Case c : trigger.new) {
		if (c.AccountId != null) {
			c.Owner = [SELECT Technical_Consultant__c FROM Account WHERE Id =: trigger.new[0].AccountId];
		}
	}	
}

 The current problem (aside from the whole approach possibly being completely wrong) is with the query. I've tried multiple iterations, none of which have compiled without an error of some sort, the latest of which doesn't even make sense to me:

 

Save error: Illegal assignment from LIST<Account> to SOBJECT:Name

I had been trying to reference the "Name" field on account and that error sort of made sense then, but now I don't know what it's trying to tell me. Technical_consultant__c is a lookup field to User on Account.

 

I also question whether this can be a "before insert" trigger -- does the account for EmailToCase cases get looked up before insert, or is it a post insert operation? Obviously if the account hasn't been assigned until after the case is inserted then I'll have to change the trigger type and I'll have more work to do. I'm going to keep pounding my head against this today, but if anyone can offer any suggestions on just how completely wrong I am, I'd appreciate it.

 

Thanks,

Matt

Hi,

 

I'm looking for an easy way to quickly identifiy which messages in my mail boxes have been uploaded for SalesForce. Would it be possible to add a feature at some point that allows us to specify a marking option (text color, bgcolor, etc. or perhaps just fire a user-defined rule)? In the meantime, is there a script I could edit or something? 

 

Sorry if this has been asked before (seems likely) -- tried searching for it, but didn't come up with anything.

 

Thanks,

Matt

We use EmailToCase and are looking to enhance it a bit. Each account has a specific technical consultant assigned to it and they are supposed to handle Tier 1 support for the account, so we would like the case to be owned by them as soon as it is submitted. It seems that the only way of accomplishing this is via an Apex trigger, which I've been trying to write for the past couple of days. I've successfully written one previously and this one seems conceptually simple, but there seem to be some nuances that I'm just not getting. My rudimentary stab at it currently looks like this:

 

trigger AssignTechnicalConsultantToCase on Case (before insert) {
	for (Case c : trigger.new) {
		if (c.AccountId != null) {
			c.Owner = [SELECT Technical_Consultant__c FROM Account WHERE Id =: trigger.new[0].AccountId];
		}
	}	
}

 The current problem (aside from the whole approach possibly being completely wrong) is with the query. I've tried multiple iterations, none of which have compiled without an error of some sort, the latest of which doesn't even make sense to me:

 

Save error: Illegal assignment from LIST<Account> to SOBJECT:Name

I had been trying to reference the "Name" field on account and that error sort of made sense then, but now I don't know what it's trying to tell me. Technical_consultant__c is a lookup field to User on Account.

 

I also question whether this can be a "before insert" trigger -- does the account for EmailToCase cases get looked up before insert, or is it a post insert operation? Obviously if the account hasn't been assigned until after the case is inserted then I'll have to change the trigger type and I'll have more work to do. I'm going to keep pounding my head against this today, but if anyone can offer any suggestions on just how completely wrong I am, I'd appreciate it.

 

Thanks,

Matt