

Last date modified: March 18 2025
You can use the Field Mapping service to perform various operations related to mapping fields between Relativity and an external data source. It supports retrieving fields available for mapping from the data source and retrieving fields in Relativity that are already mapped. In addition, it provides methods for updating and reading existing field mappings.
Note: Currently, this service supports managing only the mappings between fields in Relativity and Invariant. This functionality supports the processing feature available in Relativity. For more information, see Processing on the Relativity
When developing an application, you can use the Field Mapping service to return fields used for mapping in a custom UI. For example, you might develop a custom dialog that gets populated with mappable fields. The Relativity UI includes the following dialog that exemplifies this functionality:
You can also use the Field Mapping service through the REST API. For more information, see Field Mapping Manager (REST).
In addition, the Relativity.Services.FieldMapping namespace also contains the following classes:
A common workflow for field mapping includes the following steps:
Review the code samples to learn about using the Field Mapping service to perform retrieval, update, and other operations. These code samples illustrate how to perform the following general tasks, and how to call specific methods on the Field Mapping service:
From Relativity, you can make a call to the IsFieldMappingAvailableAsync() method to check the availability of an external data source. This method returns true when field mapping is available. When this method returns false, your data source isn't currently available. You may want to contact your system admin to troubleshoot this issue.
IsFieldMappingAvailableAsync: Returns a boolean flag indicating whether or not Field Mapping functionality is available
1
2
3
4
using (IFieldMappingManager proxy = _servicesMgr.CreateProxy<IFieldMappingManager>(ExecutionIdentity.CurrentUser))
{
bool fieldMappingAvailable = await proxy.IsFieldMappingAvailableAsync(data.WorkspaceId).ConfigureAwait(false);
}
From Invariant, you can call the GetAllMappedFieldsAsync() method to retrieve an array of Relativity fields currently mapped to Invariant fields.
1
2
3
4
using (IFieldMappingManager proxy = _servicesMgr.CreateProxy<IFieldMappingManager>(ExecutionIdentity.CurrentUser))
{
List<ExternalMapping> mappings = await proxy.GetAllMappedFieldsAsync(data.WorkspaceId, dataSourceID, new List<Guid>()).ConfigureAwait(false);
}
Array of CatalogField objects
1
2
3
4
using (IFieldMappingManager proxy = _servicesMgr.CreateProxy<IFieldMappingManager>(ExecutionIdentity.CurrentUser))
{
CatalogField[] catalogFields = await proxy.GetCatalogFieldsAsync(data.WorkspaceId).ConfigureAwait(false);
}
From Relativity, you can call the GetInvariantFieldsAsync() method to retrieve an array of Invariant fields available for field mapping. This array includes Invariant fields that haven't been mapped to any Relativity fields.
1
2
3
4
using (IFieldMappingManager proxy = _servicesMgr.CreateProxy<IFieldMappingManager>(ExecutionIdentity.CurrentUser))
{
List<MappableSourceField> sourceFields = await proxy.GetInvariantFieldsAsync(data.WorkspaceId, false).ConfigureAwait(false);
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
FieldMappingRequest request = new FieldMappingRequest
{
Filter = new FieldFilter
{
NameFilter = "Hello World",
DataTypeFilter = null,
DescriptionFilter = null,
RelativityFieldNameFilter = null
},
SortingOption = new FieldSortingOption
{
FieldName = FieldName.Name,
SortingDirection = SortingDirection.Asc
}
};
using (IFieldMappingManager proxy = _servicesMgr.CreateProxy<IFieldMappingManager>(ExecutionIdentity.CurrentUser))
{
FieldMappingResponse response = await proxy.GetInvariantFieldsPaginatedAsync(data.WorkspaceId, 0, 10, request).ConfigureAwait(false);
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
FieldMappingRequest request = new FieldMappingRequest
{
Filter = new FieldFilter
{
NameFilter = "Metadata Field 1",
DataTypeFilter = null,
DescriptionFilter = null,
RelativityFieldNameFilter = null
},
SortingOption = new FieldSortingOption
{
FieldName = FieldName.DataType,
SortingDirection = SortingDirection.Desc
}
};
using (IFieldMappingManager proxy = _servicesMgr.CreateProxy<IFieldMappingManager>(ExecutionIdentity.CurrentUser))
{
FieldMappingResponse response = await proxy.GetMetadataFieldsAsync(data.WorkspaceId, 0, 10, request).ConfigureAwait(false);
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
FieldMappingRequest request = new FieldMappingRequest
{
Filter = new FieldFilter
{
NameFilter = "Other Field 1",
DataTypeFilter = null,
DescriptionFilter = null,
RelativityFieldNameFilter = null
},
SortingOption = new FieldSortingOption
{
FieldName = FieldName.Name,
SortingDirection = SortingDirection.Desc
}
};
using (IFieldMappingManager proxy = _servicesMgr.CreateProxy<IFieldMappingManager>(ExecutionIdentity.CurrentUser))
{
FieldMappingResponse response = await proxy.GetOtherFieldsAsync(data.WorkspaceId, 0, 10, request).ConfigureAwait(false);
}
MappableSourceField object
1
2
3
4
using (IFieldMappingManager proxy = _servicesMgr.CreateProxy<IFieldMappingManager>(ExecutionIdentity.CurrentUser))
{
MappableSourceField field = await proxy.GetMappableSourceFieldAsync(data.WorkspaceId, "MySourceField").ConfigureAwait(false);
}
From Relativity, you can call the ReadExternalMappingAsync() method to retrieve the external field mapping for a field with a specified Artifact ID.
ExternalMapping object
1
2
3
4
using (IFieldMappingManager proxy = _servicesMgr.CreateProxy<IFieldMappingManager>(ExecutionIdentity.CurrentUser))
{
ExternalMapping mapping = await proxy.ReadExternalMappingAsync(data.WorkspaceId, fieldID, fieldSource).ConfigureAwait(false);
}
From Relativity, you can call the UpdateExternalMappingAsync() method to modify or insert field mapping data.
1
2
3
4
5
6
7
8
9
10
ExternalMapping model = new ExternalMapping
{
FieldID = fieldID,
ExternalFieldName = "FieldName",
ExternalFieldSource = "Invariant"
};
using (IFieldMappingManager proxy = _servicesMgr.CreateProxy<IFieldMappingManager>(ExecutionIdentity.CurrentUser))
{
await proxy.UpdateExternalMappingAsync(data.WorkspaceId, fieldID, model).ConfigureAwait(false);
}
You can use the GetAutomappedFieldGuidsAsync() method to retrieve certain processing system fields that Invariant automatically maps during a publish operation. When you call this method, pass the Artifact ID of the workspace where you want to map fields. It returns a list of GUIDs for the corresponding ExternalMapping objects.
1
2
3
4
using (IFieldMappingManager proxy = _servicesMgr.CreateProxy<IFieldMappingManager>(ExecutionIdentity.CurrentUser))
{
List<Guid> autoMappedFieldGuids = await proxy.GetAutoMappedFieldGuidsAsync(data.WorkspaceId).ConfigureAwait(false);
}
On this page
Why was this not helpful?
Check one that applies.
Thank you for your feedback.
Want to tell us more?
Great!
Additional Resources |
|||
DevHelp Community | GitHub | Release Notes | NuGet |