Note that there are some explanatory texts on larger screens.

plurals
  1. POUpdate custom cascading select field in JIRA via suds
    primarykey
    data
    text
    <p>Using JIRA version 4.2. With Python 2.7 and suds 0.4, how can I update an issue's custom cascading select's field (both parent and child)?</p> <p>There is a <a href="http://confluence.atlassian.com/display/JIRA/Creating+a+SOAP+Client" rel="nofollow">SOAPpy example</a> available under "Python (SOAPPy) client". I was <a href="https://studio.plugins.atlassian.com/browse/JCLIMD-9" rel="nofollow">unable to perform</a> this type of update using the <a href="https://studio.plugins.atlassian.com/browse/JCLIMD" rel="nofollow">Python JIRA CLI</a>.</p> <p>Example: When updating the cascading select custom child of parent field, customfield_10, one would want to update the field customfield_10_1.</p> <p><strong>Update</strong></p> <p>Code to display cascading field's original value:</p> <pre><code>issue = client.service.getIssue(auth, "NAHLP-33515") for f in fields: if f['customfieldId'] == 'customfield_10050' or f['customfieldId'] == 'customfield_10050_1': print f </code></pre> <p>This results in:</p> <pre><code>(RemoteCustomFieldValue){ customfieldId = "customfield_10050" key = None values[] = "10981", } </code></pre> <p>After manually setting the cascading field's child, the above code results in:</p> <pre><code>(RemoteCustomFieldValue){ customfieldId = "customfield_10050" key = None values[] = "10981", } (RemoteCustomFieldValue){ customfieldId = "customfield_10050" key = "1" values[] = "11560", } </code></pre> <p><strong>The above values is what I hope to achieve via suds</strong>.</p> <p>Note the <em>key = "1"</em> field. The key value designates that this object is the child of customfield_10050.<br> <a href="http://docs.atlassian.com/software/jira/docs/api/rpc-jira-plugin/latest/com/atlassian/jira/rpc/soap/beans/RemoteCustomFieldValue.html" rel="nofollow">Documentation reference</a>: <em>parentKey - Used for multi-dimensional custom fields such as Cascading select lists. Null in other cases</em></p> <p>Let's try sending a key field value:</p> <pre><code>client.service.updateIssue(auth, "NAHLP-33515", [ {"id":"customfield_10050", "values":["10981"]}, {"id":"customfield_10050_1", "key":"1", "values":["11560"]} ]) </code></pre> <p>This results in an error because the <a href="http://docs.atlassian.com/software/jira/docs/api/rpc-jira-plugin/latest/com/atlassian/jira/rpc/soap/JiraSoapService.html#updateIssue%28java.lang.String%2C%20java.lang.String%2C%20com.atlassian.jira.rpc.soap.beans.RemoteFieldValue%5B%5D%29" rel="nofollow">updateIssue</a> accepts a <a href="http://docs.atlassian.com/software/jira/docs/api/rpc-jira-plugin/latest/com/atlassian/jira/rpc/soap/beans/RemoteFieldValue.html" rel="nofollow">RemoteFieldValue</a>[] parameter, not a <a href="http://docs.atlassian.com/software/jira/docs/api/rpc-jira-plugin/latest/com/atlassian/jira/rpc/soap/beans/RemoteCustomFieldValue.html" rel="nofollow">RemoteCustomFieldValue</a>[] parameter (<a href="http://confluence.atlassian.com/display/JIRA/Creating+a+SOAP+Client?focusedCommentId=232555101#comment-232555101" rel="nofollow">thanks Matt Doar</a>):</p> <pre><code>suds.TypeNotFound: Type not found: 'key' </code></pre> <p>So how do we pass a RemoteCustomFieldValue parameter to update an issue?</p> <p><strong>Update 2, mdoar's answer</strong></p> <p>Ran following code via suds:</p> <pre><code>client.service.updateIssue(auth, "NAHLP-33515", [ {"id":"customfield_10050", "values":["10981"]}, {"id":"customfield_10050_1", "values":["11560"]} ])` </code></pre> <p>After value:</p> <pre><code>(RemoteCustomFieldValue){ customfieldId = "customfield_10050" key = None values[] = "10981", } </code></pre> <p>Unfortunately, this does not update the child of customfield_10050. Verified manually.</p> <p><strong>Resolution:</strong></p> <p>Thank you mdoar! To update a parent and child of a cascading select field, use the colon (':') to designate the child filed.</p> <p><strong>Working example:</strong></p> <pre><code>client.service.updateIssue(auth, "NAHLP-33515", [ {"id":"customfield_10050", "values":["10981"]}, {"id":"customfield_10050:1", "values":["11560"]} ]) </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload