diff --git a/src/core_modules/capture-core/components/FormFields/New/Fields/OrgUnitField/SingleOrgUnitSelectField.component.js b/src/core_modules/capture-core/components/FormFields/New/Fields/OrgUnitField/SingleOrgUnitSelectField.component.js index 7946993a79..6c252f087b 100644 --- a/src/core_modules/capture-core/components/FormFields/New/Fields/OrgUnitField/SingleOrgUnitSelectField.component.js +++ b/src/core_modules/capture-core/components/FormFields/New/Fields/OrgUnitField/SingleOrgUnitSelectField.component.js @@ -13,7 +13,7 @@ const getStyles = () => ({ type OrgUnitValue = { id: string, - displayName: string, + name: string, path: string, } @@ -44,7 +44,7 @@ class SingleOrgUnitSelectFieldPlain extends React.Component { const { classes } = this.props; return (
- {selectedOrgUnit.displayName} + {selectedOrgUnit.name}
); } @@ -52,7 +52,7 @@ class SingleOrgUnitSelectFieldPlain extends React.Component { onSelectOrgUnit = (orgUnit: Object) => { this.props.onBlur({ id: orgUnit.id, - displayName: orgUnit.displayName, + name: orgUnit.displayName, path: orgUnit.path, }); } diff --git a/src/core_modules/capture-core/components/Pages/common/TEIRelationshipsWidget/TrackedEntityRelationshipsWrapper/TrackedEntityRelationshipsWrapper.component.js b/src/core_modules/capture-core/components/Pages/common/TEIRelationshipsWidget/TrackedEntityRelationshipsWrapper/TrackedEntityRelationshipsWrapper.component.js index 7be6a4a07b..28b3f0b25d 100644 --- a/src/core_modules/capture-core/components/Pages/common/TEIRelationshipsWidget/TrackedEntityRelationshipsWrapper/TrackedEntityRelationshipsWrapper.component.js +++ b/src/core_modules/capture-core/components/Pages/common/TEIRelationshipsWidget/TrackedEntityRelationshipsWrapper/TrackedEntityRelationshipsWrapper.component.js @@ -15,7 +15,7 @@ import { } from '../../../NewRelationship/TeiRelationship/SearchResults/TeiRelationshipSearchResults.component'; import { ResultsPageSizeContext } from '../../../shared-contexts'; import { RegisterTei } from '../RegisterTei'; -import { useOrganisationUnit } from '../../../../../dataQueries'; +import { useCoreOrgUnit } from '../../../../../metadataRetrieval/coreOrgUnit'; export const TrackedEntityRelationshipsWrapper = ({ trackedEntityTypeId, @@ -29,7 +29,8 @@ export const TrackedEntityRelationshipsWrapper = ({ }: Props) => { const dispatch = useDispatch(); const { relationshipTypes, isError } = useTEIRelationshipsWidgetMetadata(); - const { orgUnit: initialOrgUnit } = useOrganisationUnit(orgUnitId, 'id,displayName,code'); + const { orgUnit } = useCoreOrgUnit(orgUnitId); + const initialOrgUnit = orgUnit ? { id: orgUnitId, name: orgUnit.name, path: orgUnit.path } : null; const onSelectFindMode = ({ findMode, relationshipConstraint }: OnSelectFindModeProps) => { dispatch(selectFindMode({