Bug510保存成功後イベントで文字結合複数設定できるように非同期処理修正
This commit is contained in:
@@ -159,32 +159,32 @@ export class StringJoinAction implements IAction{
|
|||||||
if (!event.type.includes('success')){
|
if (!event.type.includes('success')){
|
||||||
//保存先フィールドに値セット:
|
//保存先フィールドに値セット:
|
||||||
record[this.props.saveField.code].value=saveValue;
|
record[this.props.saveField.code].value=saveValue;
|
||||||
window.alert("文字結合行いました。"+this.props.joinField1.name+":"+joinValue1+","+this.props.joinField2.name+":"+joinValue2+"。");
|
//window.alert("文字結合行いました。"+this.props.joinField1.name+":"+joinValue1+","+this.props.joinField2.name+":"+joinValue2+"。");
|
||||||
}else{
|
}else{
|
||||||
const params={
|
//kintone async/await による非同期処理(成功イベントREST API処理時):
|
||||||
"app":event.appId,
|
async function updateRecord(fieldCode:string,event:any) {
|
||||||
"id":event.recordId,
|
return new Promise((resolve, reject) => {
|
||||||
"record":{[this.props.saveField.code]:{"value":saveValue}}
|
var updatedRecord = {
|
||||||
};
|
app: event.appId,
|
||||||
return await kintone.api(kintone.api.url('/k/v1/record',true),'PUT',params).then((resp) => {
|
id: event.recordId,
|
||||||
//kintone保存先フィールド存在確認:
|
record: {[fieldCode]:{"value":saveValue}}
|
||||||
record[this.props.saveField.code].value=saveValue;
|
};
|
||||||
if (event.type.includes('index')){
|
kintone.api(kintone.api.url('/k/v1/record', true), 'PUT', updatedRecord, (resp) => {
|
||||||
window.alert("文字結合行いました。"+this.props.joinField1.name+":"+joinValue1+","+this.props.joinField2.name+":"+joinValue2+"。一覧画面更新成功後自動リロードしません。必要に応じて手動リロードください。");
|
resolve(resp);
|
||||||
}else{
|
}, (error) => {
|
||||||
window.alert("文字結合行いました。"+this.props.joinField1.name+":"+joinValue1+","+this.props.joinField2.name+":"+joinValue2+"。");
|
reject(error);
|
||||||
}
|
});
|
||||||
//一覧画面更新成功後リロード:
|
});
|
||||||
// if (event.type.includes('index')){
|
}
|
||||||
// event.url = location.href.endsWith('/') || location.href.endsWith('&') ?
|
//kintone保存先フィールド存在確認:
|
||||||
// location.href.slice(0, -1) :
|
record[this.props.saveField.code].value=saveValue;
|
||||||
// location.href + (location.href.includes('?') ? '&' : '/');
|
//kintone async/await による非同期処理:
|
||||||
// }
|
await updateRecord(this.props.saveField.code,event);
|
||||||
}).catch((error) => {
|
//一覧画面更新成功後手動リロードください:
|
||||||
event.error = 'エラーが発生しました。結合しません。システム管理者へお問合せください';
|
if (event.type.includes('index')){
|
||||||
window.alert(event.error+"error message:"+error);
|
//window.alert("文字結合行いました。"+this.props.joinField1.name+":"+joinValue1+","+this.props.joinField2.name+":"+joinValue2+"。一覧画面更新成功後自動リロードしません。必要に応じて手動リロードください。");
|
||||||
return event;
|
window.alert("文字結合には、一覧画面更新成功後自動リロードしません。必要に応じて手動リロードください。");
|
||||||
});
|
}
|
||||||
}
|
}
|
||||||
//////////////////////////////////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
result= {
|
result= {
|
||||||
|
|||||||
Reference in New Issue
Block a user