You need to sign in to do that
Don't have an account?
Vinay Salve
Quick Start - Apex Coding for Admins
Hello Team,
While doing the trailhead for Quick Start - Apex Coding for Admins - Create a Trigger, while I am creating the candidate Nina Simone, and update the ZIP Code field as "20008", system gives me an error message stating as - Candidate Zip Code does not exist in specified State.
Kindly advise where I am going incorrect.
Thanks
Vinay Kumar Salve
While doing the trailhead for Quick Start - Apex Coding for Admins - Create a Trigger, while I am creating the candidate Nina Simone, and update the ZIP Code field as "20008", system gives me an error message stating as - Candidate Zip Code does not exist in specified State.
Kindly advise where I am going incorrect.
Thanks
Vinay Kumar Salve
All Answers
Can you please verify how many triggers, workflow, validation Rule, process builder etc. for Candiate Object you have. I dont' think the error you are getting is part of any implementation you have done for this Trailhead.
Can you please also check in Org for the text Candidate Zip Code does not exist in specified State.
Request you to please assist, as I am still stuck with same error - Candidate Zip Code does not exist in specified State
Thanks
Vinay Kumar Salve
Can you also make sure all the triggers related to the object are deactivated, in case if there are?
Please find the trigger on candidate object
trigger CreateContact on Candidate__c (after insert){
//Instantiate an object called cc from the class CreateContactFromCan
CreateContactFromCan cc = new CreateContactFromCan();
//Invoke the method createContact and send a List of Candidates as an input parameter
cc.createContact(Trigger.new);
}
validation rule
VLOOKUP($ObjectType.Zip_Code__c.Fields.State__c, $ObjectType.Zip_Code__c.Fields.Name, LEFT( Zip_Postal_Code__c ,5) ) <> State_Province__c
Please assist, what am I doing incorrect
Thanks
Vinay Kumar Salve
I have tried with deactivating the validation rule, now I receive the following error, please assist, thanks
Couldn’t find the record named 'Nina Simone' with Email 'nsimone@test.com'. Please double check the instructions.
Thanks
Vinay Kumar Salve
Do you have any trigger for Contact Object? Can you deactivate any trigger related to Contact SObject? Please share the screenshot of triggers list?
I had the following trigger on contact standard object which I have now removed
1. Example Trigger on contact
trigger ExampleTrigger on Contact (after insert, after delete) {
if (Trigger.isInsert) {
Integer recordCount = Trigger.New.size();
// Call a utility method from another class
EmailManager.sendMail('vinaykumarsalve@gmail.com', 'Trailhead Trigger Tutorial',
recordCount + ' contact(s) were inserted.');
}
else if (Trigger.isDelete) {
// Process after delete
}
}
2. RestrictContactByName
trigger RestrictContactByName on Contact (before insert, before update) {
//check contacts prior to insert or update for invalid data
For (Contact c : Trigger.New) {
if(c.LastName == 'INVALIDNAME') { //invalidname is invalid
c.AddError('The Last Name "'+c.LastName+'" is not allowed for DML');
}
}
Even after removing the above mentioned trigger from contact, I still get the following error
CreateContact: execution of AfterInsert caused by: System.QueryException: List has more than 1 row for assignment to SObject Class.CreateContactFromCan.createContact: line 5, column 1 Trigger.CreateContact: line 5, column 1
Please assist, thanks
Vinay Kumar Salve
Even im Facing the same problem can anyone please help me?
Seems like your SOQL is returning multiple results for the filtere which is causing issue while you were doing any assignments based on that.