1

I'm trying to do something relatively mundane, which is store an offset value for Timezone on a custom field on the ContentVersion object. It seems like no matter what field I reference (including standard fields) I'm getting a 'variable does not exist' error.

public void setOffset(List<ContentVersion> contentVersions){
    for(ContentVersion cv : contentVersions){
        cv.Timezone_Offset_in_Hours__c=0;
    }
}

I know ContentVersion is a little weird in terms of security, but I have no trouble querying these fields through the dev console query editor, and the fields even auto-prompt through the developer console interface. So it seems a bit weird to me.

Is there some quirk I'm unaware of around setting contentversion custom fields via apex?

5
  • From where you are calling this method? Add that part of code as well Commented Nov 17, 2022 at 3:47
  • I don't think we have some setting for this. Can you relogin and try again. I tried using the same did not face any issue Commented Nov 17, 2022 at 3:53
  • is this a compile time error, or a runtime error?
    – Nick C
    Commented Nov 17, 2022 at 4:14
  • I think you have not queried the field. As you are sending the list as a parameter, make sure that you are querying the field when you are creating the list. Commented Nov 17, 2022 at 6:09
  • 2
    Please provide the full error message text in the question (edit to add it).
    – Phil W
    Commented Nov 17, 2022 at 7:06

1 Answer 1

0

Update: it was almost as mundane as the use case. There was an apex class of the same name as the SObject in the org. :-|

1
  • 1
    chalk another one up for name shadowing
    – Derek F
    Commented Nov 17, 2022 at 22:37

You must log in to answer this question.

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