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 Sign up to answer
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Published Monday in Jira Software

How large do you think Jira Software can grow?

Hi Atlassian Community! My name is Shana, and I’m on the Jira Software team. One of the many reasons this Community exists is to connect you to others on similar product journeys or with comparabl...

696 views 6 13
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