2

fields:"Include_in_Oppty_Rollup__c"

message:"Include: value not of required type: "

statusCode:"INVALID_TYPE_ON_FIELD_IN_RECORD"

Include_in_Oppty_Rollup__c is a checkbox on my object.

I keep getting this error when I try to use this code:

estimate.fieldsToNull.Include_in_Oppty_Rollup__c=(val) ? 'TRUE' : 'FALSE';

This should set my value for Include_in_Oppty_Rollup__c field.

Has anyone faced the same issue?

2 Answers 2

3

Probably it is throwing that error because you are using 'True' and 'False'. Those values are of type String. Remove the '' to use Boolean instead of String.

Try this: estimate.fieldsToNull.Include_in_Oppty_Rollup__c=(val) ? true : false;

1
  • If val is already a Boolean, you can use it directly: record.Field__c = val;
    – Trang Oul
    Commented Mar 30, 2022 at 9:07
1

I know this answer is a bit late, but simply said you may get this error for the following reasons.

  1. you are inserting the wrong data value into the field of interest.
  2. You are referencing a field from a relationship field, but that relationship field is null, so the result is null, and that field might not support null values.

You must log in to answer this question.

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