TFS4JIRA Self-Hosted | How to add the SPRINT field and value mappings directly in the database
SPRINT field mapping is stored in FieldMappings
Value mappings for the mapped SPRINT field are stored in the table: ValueMappings
PYTHON script auto-generating below explained queries.
Add field mapping for Sprint field.
Run request: https://<JIRA URL>/rest/api/3/field/search?query=Sprint
Example JSON result
Prepare and run INSERT query
INSERT INTO [dbo].[FieldMappings] ([JiraField] ,[TfsField] ,[JiraDefaultValue] ,[TfsDefaultValue] ,[JiraType] ,[TfsType] ,[MappingMode] ,[MappingDirection] ,[IgnoreIllegalStateTransitions] ,[SyncProfile_Guid] ,[JiraCustomFieldName] ,[TfsListSeparator] ,[IsDefault]) VALUES (<JiraField> ,<TfsField> ,<JiraDefaultValue> ,<TfsDefaultValue> ,'array' ,<TfsType> ,2 ,<MappingDirection> ,0 ,<SyncProfile_Guid> ,<JiraCustomFieldName> ,',' ,<IsDefault>)
VALUES to provide
<JiraField> - "id" from REQUEST response, in this example: customfield_10020
<TfsField> - System.AreaPath or System.IterationPath or any other field from ADO/TFS
<JiraDefaultValue>, <TfsDefaultValue>
Raise Error - value should be: NULL
Empty Value - value should be: -empty-
Default Value - value should show either SPRINT ID or ADO FIELD value
<TfsType> - TreePath for fields System.AreaPath or System.IterationPath
<MappingDirection>
1- TFS to Jira
2- Jira to TFS
3 - Both directions
<SyncProfile_Guid> - guid of your sync profile visible by running this query
SELECT guid,name FROM SyncProfiles
<JiraCustomFieldName> - "custom" value from request JSON, in this example: com.pyxis.greenhopper.jira:gh-sprint
<IsDefault> - (0 or 1), 1 for PRIMARY mapping
Update field mapping for Sprint field.
in FieldMappings tablle, a row should be present with mapping for SPRINT and ADO field, please find the ID of that mapping (in the example case its ID: 250)
update that mapping to change Mapping Mode to MAP VALUES by running:
UPDATE FieldMappings SET MappingMode = 2 WHERE Id=<your mapping ID>
update ANYTHING ELSE functionality for Jira and ADO/TFS. Columns storing the values: JiraDefaultValue, TfsDefaultValue
Raise Error - value should be: NULL
Empty Value - value should be: -empty-
Default Value - value should show either SPRINT ID or ADO FIELD value
Add mapping for SPRINT values.
Adding value mappings for SPRINT fields mapping
Run a request to fetch all the BOARDS in the Jira PROJECT
https://<JIRA URL>/rest/agile/1.0/board?projectKeyOrId=<project key>
example result
Run a request listing all the SPRINTS in each BOARD
https://<JIRA URL>/rest/agile/1.0/board/<BOARD ID>/sprint
example result
Insert mapping in to the ValueMappings table
example query: