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
netTrekker_ADnetTrekker_AD 

Easy question: what is the Apex name for Activity Record Type?

SFDC Support build us a  custom trigger that is not doing it job and they are not wanting to make any changes to it now. All I need to know to make the changes is what is the correct name of the field that would be typed into Apex coding for Activity Record Type (Task, Event, Null).

 

In the bigger picture, where are the Apex code names of all fields located?

 

Thanks in advance!

stwdevstwdev

The name of the field used in Apex code is the same as that used with the API. Find this for any field by viewing its details (click on the field listed under the Setup menu). For custom fields, you'll want the value in the API Name field. For standard fields, you'll use the value in the Field Name field.

netTrekker_ADnetTrekker_AD

The issue Im having is that Activity Record Type is not a field per say, so under Setup I cannot find what the Apex or API name would be. I tried "a.RecordType" because for example "a.Subject" is the name of the email subject and that did not work.

stwdevstwdev

Record Types are a distinct object.

 

To assign a Record Type to a Task record, you need to set the RecordTypeId field to the ID of the appropriate Task Record Type. The name of the field to use when assigning record types to records is always RecordTypeId, regardless of the object you are setting it on.

 

To find the right RecordTypeId to set on your Task you'll either have to 1) query the RecordType object to obtain the Id for the Record Type with filter SobjectType = 'Task' and Name = 'whatever', or 2) look up the Id by clicking on its details under setup (the Id will be in the URL).