+ Start a Discussion
johutchjohutch 

how do you perform a conditional clause using a record type?

I ran into this problem when designing a class.  the pseudo code is basically

if (recordtype=software) then work on fields that are for software
else if (recordtype=hardware) then work on fields that are for hardware

the problem is: I don't know what data type to use to compare to record types
i've tried strings, integers, and doubles but i keep getting an illegal data type error.

i'm thinking it has something to do with mapping but its still not making sense because mapping uses the primitive data types

hmm... now that i think about it... i guess the question should be what primitive data members make up a recordtype class?

anyone have any input on this issue?
jpizzalajpizzala
According to the documentation, record type information is stored in the RecordTypeInfo class, which would be why the comparison was failing. Check out the explanation at the bottom of the sObject Describe Result Methods page in the Apex Language Reference.
johutchjohutch
Thank you jpizzala,

The link did provide me with more information about recordtypes and how one would go about accessing members of the class.  However, my knowledge of apex isn't as advanced as it would need to be to start using some of the schema.sobject function calls.  I'll look more into that and thank you again for pointing me into the right direction.