1

I want to assign the value of Standard field 'NewValue' of the object 'CaseHistory' to a TEXT type field of another custom object. Is it possible ? The datatype of 'NewValue' field is 'anyType' as per the below link.

https://developer.salesforce.com/docs/atlas.en-us.api.meta/api/sforce_api_objects_casehistory.htm.

And if I try to assign the 'NewValue' field value to any other TEXT type custom field like (CSHU.New_Status_Value__c = CH.NewValue;) then it throws me error saying:

Error: Compile Error: Illegal assignment from Object to String

Thanks!

1

As the error states the datatype of the NewValue field on a Case History is an Object .You may typecast into a String like below

CSHU.New_Status_Value__c = (string)CH.NewValue;

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.