JIRA SOAP in VBA how to get created issue key

Hi I created an Issue via SOAP using VBA,

(I used the code written By fabby chen https://answers.atlassian.com/questions/75585/create-jira-issues-using-vba-in-excel)

But unfortunately I don't know how to receive the created issue KEY.

Sub CreateJiraIssue()

Dim token As Variant
Dim newissue As Variant
Dim issuemap As Variant

Dim SoapClient
Set SoapClient = CreateObject("MSSOAP.SoapClient30")
SoapClient.mssoapinit ("https://jira_instance/rpc/soap/jirasoapservice-v2?wsdl")

token = SoapClient.LogIn("jirauser", "password")

If Err <> 0 Then
wscript.echo "initialization failed " + Err.description
End If

Dim new_xmlText, update_xmlText As String
new_xmlText = "<root>" & _
              "<assignee>" & "user" & "</assignee>" & _
              "<project>" & "PROJECT1" & "</project>" & _
              "<type>" & "1" & "</type>" & _
              "<summary>" & "TEST TICKET " & "</summary>" & _
            "<description>" & "this ticket was created remotely via SOAP using VBA code." & "</description>" & _
            "<customFieldValues>" & _
                    "<RemoteCustomFieldValue>" & _
                        "<customfieldId>customfield_10002</customfieldId>" & _
                        "<values><string>" & "XXX" & "</string></values>" & _
                    "</RemoteCustomFieldValue>" & _
                    "<RemoteCustomFieldValue>" & _
                        "<customfieldId>customfield_10001</customfieldId>" & _
                        "<values><string>" & "XXX" & "</string></values>" & _
                    "</RemoteCustomFieldValue>" & _
                 "</customFieldValues>" & _
Dim new_xmlDoc As New MSXML2.DOMDocument30
new_xmlDoc.async = False
new_xmlDoc.LoadXml (new_xmlText)
If (new_xmlDoc.parseError.ErrorCode <> 0) Then
  Dim myErr
  Set myErr = new_xmlDoc.parseError
  MsgBox (myErr.reason)

End If

Dim new_XMLNodeList As MSXML2.IXMLDOMNodeList
Dim new_root As MSXML2.IXMLDOMElement
Set new_root = new_xmlDoc.DocumentElement
Set new_XMLNodeList = new_root.ChildNodes

Set newissue = SoapClient.createIssue(token, new_XMLNodeList)

End Sub

anyone knows how to get the Key of the issue created?

2 answers

1 accepted

0 votes
Accepted answer


I just figured it out:

Dim read_XMLNodeList As MSXML2.IXMLDOMNodeList
Dim issueKey As String

Set read_XMLNodeList = newissue
issueKey = read_XMLNodeList(15).Text

Doesn't this work: newissue.getKey() ?

No it doesn't.

It works that way in Java, but unfortunately not in VBA :/

newissue is declared as Variant,

when I declare it as RemoteIssue, program fails.

Suggest an answer

Log in or Sign up to answer
Community showcase
Published Jan 08, 2019 in Jira

How to Jira for designers

I’m a designer on the Jira team. For a long time, I’ve fielded questions from other designers about how they should be using Jira Software with their design team. I’ve also heard feedback from other ...

1,304 views 5 11
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you