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>" & _
          "</root>"
           
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

Hi

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 Join to answer
Community showcase
Sarah Schuster
Posted Jan 29, 2018 in Jira

What are common themes you've seen across successful & failed Jira Software implementations?

Hey everyone! My name is Sarah Schuster, and I'm a Customer Success Manager in Atlassian specializing in Jira Software Cloud. Over the next few weeks I will be posting discussion topics (8 total) to ...

3,316 views 14 20
Join discussion

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
Atlassian Team Tour

Join us on the Team Tour

We're bringing product updates and pro tips on teamwork to ten cities around the world.

Save your spot