2017-10-30 35 views
1

私はインシデントテーブルに「u_custom_long_description」というカスタムフィールドを持っています。UIポリシーでは、インシデント終了時にフィールドが空であるかどうかをチェックするスクリプトを作成しました。Servicenowスクリプトの新バージョン

function onCondition() { 
    if(current.u_custom_long_description == null){ 
     alert('Please provide the description for the close comments'); 
    } 
} 

と私はあなたがサーバ側の変数currentが存在しないクライアント側のスクリプトである事件

onChange script error: ReferenceError: current is not defined function (){var o=i(m,arguments);return l.apply(n,o)}

答えて

3

を閉じたときに、私は、次のエラーを取得しています。フォーム上のフィールドの値を取得するには、g_formを使用することができます。

function onCondition() { 
    if(g_form.getValue('u_custom_long_description') == ''){ 
     alert('Please provide the description for the close comments'); 
    } 
} 

また、alertはとても90年代です!あなたはshowFieldMsgのようなものを使ってより良い経験をするでしょう。フィールド入力クライアント側の検証に関するドキュメントのこのセクションをお試しください。 https://docs.servicenow.com/bundle/jakarta-servicenow-platform/page/script/client-scripts/concept/client-script-best-practices.html#ariaid-title6

関連する問題