You need to sign in to do that
Don't have an account?
chiranth
How to match the record type name in trigger!!
Hi
In opportunity object i need to write apex trigger to send a email notification if stage is closed won and RecordType name is xyz.
Im not able to match the record type name, since I have 10 record type, I need to send a email based on the record type.
Plz help on this.
Thanks
Hi,
In Apex you can get the information related to record type by below mentioned way
For EX: if you want to get record type id then
Here replace customobject__c with your object name and recordtypename with your recordtypename.
So you can use above syntax and get any information related to Record Type.
Refer Below link which will guide you in proper way to understand and you can use it for your scenario.
http://www.salesforce.com/us/developer/docs/apexcode/Content/apex_methods_system_sobject_describe.htm
Use the RecordTypeId field on the Opportunity to filter the RecordType,
In your Trigger, query like
List<Opportunity> opplist = [Select Name from Opportunity Where RecordType.Name = 'AutoLease'];
Doc:
http://www.salesforce.com/us/developer/docs/api/Content/sforce_api_objects_opportunity.htm
Hi,
Yes the above mentioned way like where RecordType.Name is also simple for you to Query.