Are/is there any examples of setting customfield values for a customfield with a tick box setup.
I am able to do -
datadict = {}
datadict['project'] = project
datadict['summary'] = summary
datadict['description'] = description
datadict['issuetype'] = {'name':'Operations Change'}
datadict['duedate'] = date
datadict['labels'] = labelsdatadict['customfield_10263'] = {'value':platform}
datadict['customfield_10262'] = {'value':'Reference Data'}
datadict['customfield_10261'] = how
session.create_issue(fields=datadict)
But I want to add to a customfield with a tickbox and I can see
Field: customfield_10346 Value: [{'self': 'https://aquis.atlassian.net/rest/api/2/customFieldOption/10544', 'value': 'Prod', 'id': '10544'}, {'self': 'https://aquis.atlassian.net/rest/api/2/customFieldOption/10545', 'value': 'Test', 'id': '10545'}]
so do I need to know the customFieldOption ids for all those options.
would the correct approach to be to build up a list of values for values I need
ids = { 'Prod':'10544,'Test':'10545'] etc
and the build the list to look something like below?
datadict['customfield_10346'] =[ {'self': 'https://aquis.atlassian.net/rest/api/2/customFieldOption/10544', 'value': 'Prod', 'id': '10544'}, {'self': 'https://aquis.atlassian.net/rest/api/2/customFieldOption/10545', 'value': 'Test', 'id': '10545'}]
Any pointers appreciated.
To answer my own question with some imput from David Bakkers
geerate a list of the tickbox items needed --
values = [{'value':'Prod'},{'value':'Test'}]
then using the customfield i posted
datadict['customfield_10346'] = values
Hello @Jonathan Birchall
so do I need to know the customFieldOption ids for all those options.
Only if you are changing an existing option's value. The ID per option is because options are allowed to have identical values, so you need a unique identifier to reference them.
would the correct approach to be to build up a list of values for values I need
Yes, if you are adding a complete set of options to the field. Once you add all the options and their values, each option will automatically be given a unique IDs (IE. you do not declare an ID when creating the options, Jira handles that).
Note. If you want to add new options to an existing set for an existing field, you can't insert or append them, you have to erase and re-build the whole option set for that field:
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.