Skip to content

Commit 720939a

Browse files
Fixes DynamicForm trying to load TaxonomyFields with wrong display name. Closes #1422
1 parent d20134a commit 720939a

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

src/controls/dynamicForm/DynamicForm.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -426,7 +426,7 @@ export class DynamicForm extends React.Component<IDynamicFormProps, IDynamicForm
426426
defaultValue = [];
427427
}
428428
} else if (fieldType === "TaxonomyFieldTypeMulti") {
429-
const response = await this._spService.getTaxonomyFieldInternalName(this.props.listId, field.InternalName, this.webURL);
429+
const response = await this._spService.getTaxonomyFieldInternalName(this.props.listId, field.TextField, this.webURL);
430430
hiddenName = response.value;
431431
termSetId = field.TermSetId;
432432
anchorId = field.AnchorId;

src/services/SPService.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -578,10 +578,10 @@ export default class SPService implements ISPService {
578578
}
579579
}
580580

581-
public async getTaxonomyFieldInternalName(listId: string, fieldName: string, webUrl?: string): Promise<any> { // eslint-disable-line @typescript-eslint/no-explicit-any
581+
public async getTaxonomyFieldInternalName(listId: string, fieldId: string, webUrl?: string): Promise<any> { // eslint-disable-line @typescript-eslint/no-explicit-any
582582
try {
583583
const webAbsoluteUrl = !webUrl ? this._context.pageContext.web.absoluteUrl : webUrl;
584-
const apiUrl = `${webAbsoluteUrl}/_api/web/lists(@listId)/Fields/getByInternalNameOrTitle('${fieldName}_0')/InternalName?@listId=guid'${encodeURIComponent(listId)}'`;
584+
const apiUrl = `${webAbsoluteUrl}/_api/web/lists(@listId)/Fields/getById(guid'${fieldId}')/InternalName?@listId=guid'${encodeURIComponent(listId)}'`;
585585

586586
const data = await this._context.spHttpClient.get(apiUrl, SPHttpClient.configurations.v1);
587587
if (data.ok) {

0 commit comments

Comments
 (0)