You need to sign in to do that
Don't have an account?
KatherineC
How to create a Pint automatically when a Case is created?
Hi All,
I created an Object Pint, we want the Pint to be self-generated when a Case is created and the case type is Rate Change, I get error message that invalid type.
trigger AutoCreatePin on Case (after insert) {
for (Case c : Trigger.new) {
if (c.Type == 'Rate Change') {
Pint p = new Pint();
p.AccountId = c.AccountId;
insert p;
}
}
}
Error: Compile Error: Invalid type: Pint at line 4 column 32
Even I change to "Pint_c" it still says invalid type. Anyone can tell me why?
Thanks.
I created an Object Pint, we want the Pint to be self-generated when a Case is created and the case type is Rate Change, I get error message that invalid type.
trigger AutoCreatePin on Case (after insert) {
for (Case c : Trigger.new) {
if (c.Type == 'Rate Change') {
Pint p = new Pint();
p.AccountId = c.AccountId;
insert p;
}
}
}
Error: Compile Error: Invalid type: Pint at line 4 column 32
Even I change to "Pint_c" it still says invalid type. Anyone can tell me why?
Thanks.
https://www.salesforce.com/us/developer/docs/api/Content/sforce_api_objects_case.htm
All Answers
Hello.
I'm Shingo Yamazaki.
Did you change BOTH "Pint" like this?
Yes, I changed both Pint to Pint_c it still says invalid type, don't know why.
Not "Pint_c" but "Pint__c".
If so, have you already created or deployed the custom object "Pint__c"?
trigger AutoCreatePin on Case (after insert) {
for (Case c : Trigger.new) {
if (c.Type == 'Rate Change') {
Pint__c p = new Pint__c();
p.Account__c = c.Account;
insert p;
}
}
}
Error: Compile Error: Illegal assignment from SOBJECT:Account to Id at line 5 column 24
I just want to make sure it's under the same account so I put "p.Account__c = c.Account;" is it wrong again?
https://www.salesforce.com/us/developer/docs/api/Content/sforce_api_objects_case.htm