Announcement

Collapse
No announcement yet.

Sending text from Excel VBA to ServiceNow Text Area

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Sending text from Excel VBA to ServiceNow Text Area



    Hello Everyone!

    I'm trying to fill out text area in ServiceNow ticketing tool using VBA, but sadly I've been stuck for a couple of days now..

    So far I've been successfully using this method and this exact (excluding site's tittle and text area ID) code to fill out text area in different ticketing tool, however in ServiceNow it's not doing anything for some reason.

    it does seem to hook into the page just fine, as I can get the return value on the tittle (opening new IE instance with VBA and hooking to it also haven't helped), but while trying to set a value of text area (description field, or any other for that matter) it doesn't send any text over + it also doesn't return any value for any of the other ID's on the web page.

    I've tried doing it in few different ways like using .innerHTML, .Value and .text but none seem to either send or return any value, setting it as an object, sending it with pure IE.document.getElementById("incident.comments").value = "test" but to no anvil.


    Any pointers on what I might be doing wrong would be greatly appreciated - thank you very much in advance.



     Sub Test()        Dim IE As Object     Set IE = CreateObject("InternetExplorer.Application")        marker = 0 Set objShell = CreateObject("Shell.Application") IE_count = objShell.Windows.Count For X = 0 To (IE_count - 1)     On Error Resume Next     my_url = objShell.Windows(X).document.Location     my_title = objShell.Windows(X).document.Title      If my_title Like "INC0010005" & "*" Then         Set IE = objShell.Windows(X)         marker = 1         Exit For     Else     End If Next   If marker = 0 Then     MsgBox ("Website not found")     Exit Sub End If   'trying to send "test" text into the field, nothing comes up    Set notesObj = IE.document.getElementById("incident.comments")    notesObj.Value = "test"     tests = IE.document.getElementById("incident.comments").innerHTML  'testing for return value (comes up as empty message box each time)    MsgBox (tests)   Set evt = IE.document.createEvent("keyboardevent") evt.initEvent "change", True, False     notesObj.dispatchEvent evt    End Sub 



    Text area:

    Code:
     <textarea name="incident.comments" class="form-control" id="incident.comments" aria-required="false" style="height: 64px; overflow: hidden; -ms-overflow-y: hidden; -ms-word-wrap: break-word;" spellcheck="true" onkeydown="multiKeyDown(this);;" onkeyup="multiModified(this);fieldTyped(this);" onkeypress="" onfocus="this.isFocused=true;" onblur="this.isFocused=false;" onchange="this.isFocused=false;multiModified(this)" wrap="soft" autocomplete="off" data-type="glide_journal_input" data-ref="incident.comments" data-charlimit="false" data-length="4000"></textarea>
    Last edited by Farcal; 1 week ago.
Working...
X