お世話になります。
登録又は変更時に、画面上のドロップダウンの値を動的に変化させたいのですが、エラーが発生していて登録&更新が行えません。
変更前:sample1, sample2
変更後:A, B, C
すみませんが、どこが悪いのかをご教授いただけないでしょうか。
よろしくお願いいたします。
※管理者権限で実行しております。
==========================================================================
(function() {
‘use strict’;
kintone.events.on([‘app.record.create.show’], function(event) {
// アプリID取得
var appId = kintone.app.getId();
var par = {
app : appId
};
// 初期フィールドの値を確認
kintone.api(kintone.api.url(‘/k/v1/app/form/fields’, true), ‘GET’, par, function(resp) {
// フィールドの値を変更
var new_Pro = {
“app” : appId,
“properties” : {
“選択” : {
“code” : “選択”,
“defaultValue” : “A”,
“label” : “選択”,
“noLabel” : false,
“options” : {
“A” : {
“label” : “A”,
“index” : “0”
},
“B” : {
“label” : “B”,
“index” : “1”
},
“C” : {
“label” : “C”,
“index” : “2”
}
},
“required” : true,
“type” : “DROP_DOWN”
}
},
};
// 更新後のフィールドの値を確認
kintone.api(kintone.api.url(‘/k/v1/app/form/fields’, true), ‘POST’, new_Pro, function(resp1) {
location.reload();
}, function(error) {
alert(“error”);
});
});
return event;
});
※更新ロジックは、”POST”が”PUT”と「キー設定:あり」だけなので、割愛してあります。
==========================================================================
エラー内容
/k/v1/app/form/fields.json:1 Failed to load resource: the server responded with a status of 405 (Method Not Allowed)
{"code":"CB_JH01","id":"ZQXwHFWquJJmP1KyFnbE","message":"認証に失敗しました。セッション認証には、「X-Requested-With」ヘッダーが必要です。"}
==========================================================================