2017-08-11 13 views
-2

vbscriptを実行すると、インシデント参照番号を取得しようとしています。スクリプトは、コード内のスクリプトチケット値でチケットを開きますが、それは次のエラーを返します。エラー:必要なオブジェクト:「oWSResponseDoc.selectSingleNode(...)」vbscriptを実行するとインシデント参照番号が取得されない

は、私が使用していたコードは

です
' 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/

あなたは私を助けてくださいことはできますか?どうもありがとう!

+0

あなたが解決しようとしている特定のケースはありますか?あなたはvbscriptを避ける方が良いかもしれません。 – Kirk

+0

私が解決しようとしている特定のケースは、実際にはこれがキャップカークです!私はvbscriptが大好きです。 – Malbordio

答えて

0

インシデントを挿入する前に、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!" 
+0

助けてくれてありがとう。私はインシデントが作成されていることを知っていますが、番号が付いたポップアップウィンドウが表示されましたか?私は私の側にそれを取得していないよ。私はvbscriptを直接実行しています。あなたはpowershellを使ってそれを手に入れましたか? – Malbordio

+0

ええ、powershellからちょうどです。いいえポップアップ、それはちょうどコンソールの出力にあります。直接実行している場合は、ポップアップが必要です。私はそれが役立つ場合は、ポップアップを行うためにいくつかの行を追加しました – Kirk

+0

残念ながら、まだ同じエラー、まだポップアップはありません。 すでにエコーがあると同時にポップアップを挿入しようとしていますが、そうですか? 助けてくれてありがとう! – Malbordio

関連する問題