1

I have piece of code below:

for(Schema.FieldSetMember fsm : SObjectType.Vacancy_D2D__c.FieldSets.Tooltip_fields.getFields()){
   if(fsm.getType() == 'String'){
       tool += Utility.addTableRow(fsm.getLabel(), String.valueOf(d.get(fsm.getFieldPath())));
   }}

I just want to check what kind of data it has returned abd based on that I'll proceed. But I'm getting error as below.

Comparison arguments must be compatible types: Schema.DisplayType, String

1 Answer 1

2

fsm.getType() return Schema.DisplayType value so to compare it with string data type you need to convert it into string.

for(Schema.FieldSetMember fsm : SObjectType.Vacancy_D2D__c.FieldSets.Tooltip_fields.getFields()){
   if(String.valueOf(fsm.getType()) == 'String'){
       tool += Utility.addTableRow(fsm.getLabel(), String.valueOf(d.get(fsm.getFieldPath())));
   }}

or you can also use Schema.DisplayType.String

if(fsm.getType() == Schema.DisplayType.String){
           tool += Utility.addTableRow(fsm.getLabel(), String.valueOf(d.get(fsm.getFieldPath())));
       }}
0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .