You need to sign in to do that
Don't have an account?
Trigger - Help with Invalid Type
Hello,
I've recently started working with triggers and I seem to be having problems with custom objects. I've tried this a few different ways, but I get either Invalid Type(what this is getting now) or Invalid sObject if I try to query SFDC_Bug_c.
Any help you could give me would be greatly appreciated.
Thanks,
trigger SendToBug on Case (before update) {
for(Case c : Trigger.new){
if(c.Reason == 'Bug')
SDFC_Bug_c b = new SDFC_Bug_c(Status_c='Open', Priority_c='P3-Medium', Problem_Description_c = c.Description);
insert b;
}
}
Well, I dont know your custom object definitions, but is this mispelled: SDFC_Bug__c? Should it be SFDC_Bug__c?
You can verify by using the Force.com IDE Schema Browser (open up the salesforce.schema icon in your Force.com IDE Project)
All Answers
Try two underscores, SDFC_Bug__c
Also, I suggest not inserting the new SDFC_Bug__c record within the For Loop. instead I would add the record to a List or Collection and then after the FOR loop completes, do a single insert of the List. Much more efficient and scalable.
Thanks, aalbert. Unfortunately I am still getting the same error with two underscores(SDFC_Bug__c).
I see what you're saying about the For loop also.
Save error: Invalid type: SDFC_Bug__c
Well, I dont know your custom object definitions, but is this mispelled: SDFC_Bug__c? Should it be SFDC_Bug__c?
You can verify by using the Force.com IDE Schema Browser (open up the salesforce.schema icon in your Force.com IDE Project)
Thanks so much. Sorry for my Dyslexia! That was exactly what it was. WOW!!!
Thanks again.