运行 vbscript 时未获得事件参考号



我在运行 vbscript 时尝试检索事件参考编号。脚本打开代码中包含脚本票证值的票证,但它返回以下错误:错误:必需对象:"oWSResponseDoc.selectSingleNode(...(">

我使用的代码是

' Perform the insert and check the status
If Not wsInsertIncident.Post Then
WScript.Echo "Error=" & wsInsertIncident.Status 
WScript.Echo wsInsertIncident.StatusText
WScript.Quit
End If
Dim strIncidentSysId, strIncidentNumber
strIncidentSysId = wsInsertIncident.GetValue("sys_id")
strIncidentNumber = wsInsertIncident.GetValue("number")
WScript.Echo "Inserted: " & strIncidentNumber

我知道这在过去有效,但今天它不起作用。我不知道发生了什么变化。完整的脚本可以在这里看到:

https://servicenowsoap.wordpress.com/2013/10/26/vb-script/

你能帮帮我吗?非常感谢!

您需要先使用SetMethod函数,然后才能插入事件。这用于确定在进行 Web 调用时要执行的操作。

我在演示实例上对此进行了测试,它创建了事件并返回了一个数字。

' Specify the ticket values
Dim wsInsertIncident : Set wsInsertIncident = New ServiceNowDirectWS
wsInsertIncident.SetMethod "incident", "insert"
wsInsertIncident.SetValue "short_description", "Demo WS Incident"
wsInsertIncident.SetValue "description", "Demo WS Incident"
wsInsertIncident.SetValue "caller_id", "Abel Tuter"
wsInsertIncident.SetValue "category", "hardware"
wsInsertIncident.SetValue "subcategory", "mouse"
' Perform the insert and check the status
If Not wsInsertIncident.Post Then
WScript.Echo "Error=" & wsInsertIncident.Status 
WScript.Echo wsInsertIncident.StatusText
WScript.Quit
End If
Dim strIncidentSysId, strIncidentNumber
strIncidentSysId = wsInsertIncident.GetValue("sys_id")
strIncidentNumber = wsInsertIncident.GetValue("number")
WScript.Echo "Inserted: " & strIncidentNumber
Dim objShell : Set objShell = Wscript.CreateObject("Wscript.Shell")
objShell.Popup "Inserted: " & strIncidentNumber,, "ServiceNow ticket!"

相关内容

  • 没有找到相关文章

最新更新