@@ -37,7 +37,7 @@ import { IInstalledLanguageInfo, IItemUpdateResult, IList, ITermInfo, ChoiceFiel
3737import { cloneDeep , isEqual } from "lodash" ;
3838import { ICustomFormatting , ICustomFormattingBodySection , ICustomFormattingNode } from "../../common/utilities/ICustomFormatting" ;
3939import SPservice from "../../services/SPService" ;
40- import { IRenderListDataAsStreamClientFormResult } from "../../services/ISPService" ;
40+ import { IAppendOnlyNoteHistoryEntry , IClientFormTextFieldInfo , IRenderExtendedListFormDataResultNotesField , IRenderExtendedListFormDataResultStatic , IRenderListDataAsStreamClientFormResult } from "../../services/ISPService" ;
4141import { ISPField , IUploadImageResult } from "../../common/SPEntities" ;
4242import { FormulaEvaluation } from "../../common/utilities/FormulaEvaluation" ;
4343import { Context } from "../../common/utilities/FormulaEvaluation.types" ;
@@ -695,6 +695,21 @@ export class DynamicFormBase extends React.Component<
695695 }
696696 }
697697
698+ // Reload append-only history after save
699+ if ( listItemId && this . state . fieldCollection . some ( f => f . isAppendOnly ) ) {
700+ const updatedExtendedInfo = await this . _spService . getExtendedListFormData ( listId , listItemId , this . webURL ) ;
701+ this . setState ( prevState => ( {
702+ fieldCollection : prevState . fieldCollection . map ( field =>
703+ field . isAppendOnly
704+ ? { ...field ,
705+ notesAppendOnlyHistory : updatedExtendedInfo [ field . columnInternalName ] ,
706+ newValue : '' ,
707+ value : '' }
708+ : field
709+ )
710+ } ) ) ;
711+ }
712+
698713 this . setState ( {
699714 isSaving : false ,
700715 etag : newETag ,
@@ -1059,6 +1074,7 @@ export class DynamicFormBase extends React.Component<
10591074 let item = null ;
10601075 const isEditingItem = listItemId !== undefined && listItemId !== null && listItemId !== 0 ;
10611076 let etag : string | undefined = undefined ;
1077+ let extendedInfo : ( IRenderExtendedListFormDataResultStatic & IRenderExtendedListFormDataResultNotesField ) | undefined = undefined ;
10621078
10631079 if ( isEditingItem ) {
10641080 const spListItem = spList . items . getById ( listItemId ) ;
@@ -1076,6 +1092,13 @@ export class DynamicFormBase extends React.Component<
10761092 if ( respectETag !== false ) {
10771093 etag = item [ "odata.etag" ] ;
10781094 }
1095+
1096+ const appendOnlyFields = listInfo . ClientForms . Edit [ contentTypeName ]
1097+ . filter ( field => field . FieldType === 'Note' && ( field as IClientFormTextFieldInfo ) . AppendOnly ) ;
1098+
1099+ if ( appendOnlyFields . length > 0 ) {
1100+ extendedInfo = await this . _spService . getExtendedListFormData ( listId , listItemId , this . webURL ) ;
1101+ }
10791102 }
10801103
10811104 // Build the field collection
@@ -1087,7 +1110,8 @@ export class DynamicFormBase extends React.Component<
10871110 listId ,
10881111 listItemId ,
10891112 disabledFields ,
1090- customIcons
1113+ customIcons ,
1114+ extendedInfo
10911115 ) ;
10921116
10931117 const sortedFields = this . props . fieldOrder ?. length > 0
@@ -1133,7 +1157,7 @@ export class DynamicFormBase extends React.Component<
11331157 * @returns
11341158 */
11351159 // eslint-disable-next-line @typescript-eslint/no-explicit-any
1136- private async buildFieldCollection ( listInfo : IRenderListDataAsStreamClientFormResult , contentTypeName : string , item : any , numberFields : ISPField [ ] , listId : string , listItemId : number , disabledFields : string [ ] , customIcons : { [ key : string ] : string } ) : Promise < IDynamicFieldProps [ ] > {
1160+ private async buildFieldCollection ( listInfo : IRenderListDataAsStreamClientFormResult , contentTypeName : string , item : any , numberFields : ISPField [ ] , listId : string , listItemId : number , disabledFields : string [ ] , customIcons : { [ key : string ] : string } , extendedInfo : ( IRenderExtendedListFormDataResultStatic & IRenderExtendedListFormDataResultNotesField ) | undefined ) : Promise < IDynamicFieldProps [ ] > {
11371161 const { useModernTaxonomyPicker } = this . props ;
11381162 const tempFields : IDynamicFieldProps [ ] = [ ] ;
11391163 let order : number = 0 ;
@@ -1158,6 +1182,7 @@ export class DynamicFormBase extends React.Component<
11581182 let stringValue = null ;
11591183 const subPropertyValues : Record < string , unknown > = { } ;
11601184 let richText = false ;
1185+ let appendOnly = false ;
11611186 let dateFormat : DateFormat | undefined ;
11621187 let principalType = "" ;
11631188 let cultureName : string ;
@@ -1167,7 +1192,7 @@ export class DynamicFormBase extends React.Component<
11671192 // eslint-disable-next-line @typescript-eslint/no-explicit-any
11681193 const selectedTags : any = [ ] ;
11691194 let choiceType : ChoiceFieldFormatType | undefined ;
1170-
1195+ let notesAppendOnlyHistory : IAppendOnlyNoteHistoryEntry [ ] | undefined ;
11711196 let fieldName = field . InternalName ;
11721197 if ( fieldName . startsWith ( '_x' ) || fieldName . startsWith ( '_' ) ) {
11731198 fieldName = `OData_${ fieldName } ` ;
@@ -1205,6 +1230,11 @@ export class DynamicFormBase extends React.Component<
12051230 // Setup Note, Number and Currency fields
12061231 if ( field . FieldType === "Note" ) {
12071232 richText = field . RichText ;
1233+ appendOnly = field . AppendOnly ;
1234+ if ( field . AppendOnly ) {
1235+ notesAppendOnlyHistory = extendedInfo ?. [ field . InternalName ] ;
1236+ value = '' ;
1237+ }
12081238 }
12091239 if ( field . FieldType === "Number" || field . FieldType === "Currency" ) {
12101240 const numberField = numberFields . find ( f => f . InternalName === field . InternalName ) ;
@@ -1486,6 +1516,7 @@ export class DynamicFormBase extends React.Component<
14861516 hiddenFieldName : hiddenName ,
14871517 Order : order ,
14881518 isRichText : richText ,
1519+ isAppendOnly : appendOnly ,
14891520 dateFormat : dateFormat ,
14901521 firstDayOfWeek : defaultDayOfWeek ,
14911522 listItemId : listItemId ,
@@ -1496,7 +1527,8 @@ export class DynamicFormBase extends React.Component<
14961527 showAsPercentage : showAsPercentage ,
14971528 customIcon : customIcons ? customIcons [ field . InternalName ] : undefined ,
14981529 useModernTaxonomyPickerControl : useModernTaxonomyPicker ,
1499- choiceType : choiceType
1530+ choiceType : choiceType ,
1531+ notesAppendOnlyHistory : notesAppendOnlyHistory
15001532 } ) ;
15011533
15021534 // This may not be necessary now using RenderListDataAsStream
0 commit comments