function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Felix Jong Seok ChaeFelix Jong Seok Chae 

Set formula fields of other case records to a field of a given case in apex

I have a custom field called similar_cases__c and would like to include formula fields of other case records in similar_cases_c of a new case.
I am sure I set the hyperlink of formula field correctly as I can click the casenumber and it directs me to the corresponding case record page.
So I want, for example, a similar_cases__c looks like "00771120, 00771121, 00771122" and I can click on these numbers to go to pages.
Type of similar_cases__c is text.

Thank you.
 
newCase.similarCases__c = '';
                        for (Case oldCase: collectedList) {
                            newCase.similarCases__c += oldCase.TestField__c;
                        }

User-added image
Best Answer chosen by Felix Jong Seok Chae
Felix Jong Seok ChaeFelix Jong Seok Chae
All I did was to delete similarCases and remake that field and it works fine.