function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Daymon BoswellDaymon Boswell 

Trigger to only fire based on Record Type

I am writing my first Trigger in Salesforce and am trying to have it only fire based on my Case Record Type but it is not working. Here is what I have so far:

trigger CasetoJira on Case (after insert) {
if(Trigger.new[i].RecordType == '01211000000HG7CAAW'){
JCFS.API.createJiraIssue('10431', '3');
}}
Daymon BoswellDaymon Boswell
Updated it to:

trigger CasetoJira on Case (after insert) {
if(Case.RecordTypeId == 'Closed_Case_Record_Type'){
JCFS.API.createJiraIssue('10431', '3');
}}

Still not working.
Raj VakatiRaj Vakati
Here is the code
 
trigger CasetoJira on Case (after insert) {
	
	Id devRecordTypeId = Schema.SObjectType.Case.getRecordTypeInfosByName().get('Closed_Case_Record_Type').getRecordTypeId();

	for( Case ca :Trigger.new){
		
		if(ca.RecordTypeId == devRecordTypeId){
JCFS.API.createJiraIssue('10431', '3');
}

	}


}