---
sourceDocument: オーストラリア ServiceNow AI Platform の機能
sourceDocumentLink: https://servicenow-prod.fluidtopics.net/r/ja-JP/servicenow-platform

 Release :

    - australia

ft:locale :

    - ja-JP

ft:publication_title :

    - オーストラリア ServiceNow AI Platform の機能

ft:clusterId :

    - platcap

bundleId :

    - platcap

workflow :

    - Platform


---

# 例 4

# 例 4：外部ソースのレコードを更新する {#ariaid-title1}

* リリースバージョン: Australia
* 
* 更新日 2026年03月12日
* 
* ![](https://www.servicenow.com/docs/portal-asset/ico-clock) 所要時間：1分

この例では、外部ソースのインシデントレコードを更新するスクリプトを作成します。
注:  
複数のユーザーが同じレコードを同時に更新する場合、リモートシステム上の値は最後に実行された更新呼び出しの値になります。  
リモートテーブル API 情報については、次を参照してください。

* [v_query -- Scoped, Global](https://www.servicenow.com/docs/access?context=v_queryAPI&version=australia&pubname=australia-api-reference&ft:locale=en-US)
* [v_record - Scoped, Global](https://www.servicenow.com/docs/access?context=v_recordAPI&version=australia&pubname=australia-api-reference&ft:locale=en-US)
* [v_table -- Scoped, Global](https://www.servicenow.com/docs/access?context=v_tableAPI&version=australia&pubname=australia-api-reference&ft:locale=en-US)
{#remote-table-script-def-example4__vtable-api-xbl-list}

v_changed_fields は、変更されたフィールド名と値のマップです。

    (function executeUpdate(v_record, v_changed_fields) {

    	var gr = new GlideRecord('incident');
    	if (gr.get(v_changed_fields.sys_id)) {
    		Object.keys(v_changed_fields).map(function(k) {
    				switch (k){
    				case "u_number" :
    					gr.number = v_changed_fields.u_number;
    					break;
    				case "u_short_description" :
    					gr.short_description = v_changed_fields.u_short_description;
    					break;
    			}
    		});
    	gr.update();
    } else {
    	v_record.setLastErrorMessage("Missing record to update, " + v_changed_fields.sys_id);
    }

    })(v_record, v_changed_fields);


