From ee362a6a93268f4df608f9927ad82895c2c52617 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E7=8E=89?= Date: Wed, 17 Jul 2024 21:34:47 +0900 Subject: [PATCH] =?UTF-8?q?Bug510=E4=BF=9D=E5=AD=98=E6=88=90=E5=8A=9F?= =?UTF-8?q?=E5=BE=8C=E3=82=A4=E3=83=99=E3=83=B3=E3=83=88=E3=81=A7=E6=96=87?= =?UTF-8?q?=E5=AD=97=E7=B5=90=E5=90=88=E8=A4=87=E6=95=B0=E8=A8=AD=E5=AE=9A?= =?UTF-8?q?=E3=81=A7=E3=81=8D=E3=82=8B=E3=82=88=E3=81=86=E3=81=AB=E9=9D=9E?= =?UTF-8?q?=E5=90=8C=E6=9C=9F=E5=87=A6=E7=90=86=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../kintone-addins/src/actions/string-join.ts | 50 +++++++++---------- 1 file changed, 25 insertions(+), 25 deletions(-) diff --git a/plugin/kintone-addins/src/actions/string-join.ts b/plugin/kintone-addins/src/actions/string-join.ts index bc10219..c36e5ca 100644 --- a/plugin/kintone-addins/src/actions/string-join.ts +++ b/plugin/kintone-addins/src/actions/string-join.ts @@ -159,32 +159,32 @@ export class StringJoinAction implements IAction{ if (!event.type.includes('success')){ //保存先フィールドに値セット: 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{ - const params={ - "app":event.appId, - "id":event.recordId, - "record":{[this.props.saveField.code]:{"value":saveValue}} - }; - return await kintone.api(kintone.api.url('/k/v1/record',true),'PUT',params).then((resp) => { - //kintone保存先フィールド存在確認: - record[this.props.saveField.code].value=saveValue; - if (event.type.includes('index')){ - window.alert("文字結合行いました。"+this.props.joinField1.name+":"+joinValue1+","+this.props.joinField2.name+":"+joinValue2+"。一覧画面更新成功後自動リロードしません。必要に応じて手動リロードください。"); - }else{ - window.alert("文字結合行いました。"+this.props.joinField1.name+":"+joinValue1+","+this.props.joinField2.name+":"+joinValue2+"。"); - } - //一覧画面更新成功後リロード: - // if (event.type.includes('index')){ - // event.url = location.href.endsWith('/') || location.href.endsWith('&') ? - // location.href.slice(0, -1) : - // location.href + (location.href.includes('?') ? '&' : '/'); - // } - }).catch((error) => { - event.error = 'エラーが発生しました。結合しません。システム管理者へお問合せください'; - window.alert(event.error+"error message:"+error); - return event; - }); + //kintone async/await による非同期処理(成功イベントREST API処理時): + async function updateRecord(fieldCode:string,event:any) { + return new Promise((resolve, reject) => { + var updatedRecord = { + app: event.appId, + id: event.recordId, + record: {[fieldCode]:{"value":saveValue}} + }; + kintone.api(kintone.api.url('/k/v1/record', true), 'PUT', updatedRecord, (resp) => { + resolve(resp); + }, (error) => { + reject(error); + }); + }); + } + //kintone保存先フィールド存在確認: + record[this.props.saveField.code].value=saveValue; + //kintone async/await による非同期処理: + await updateRecord(this.props.saveField.code,event); + //一覧画面更新成功後手動リロードください: + if (event.type.includes('index')){ + //window.alert("文字結合行いました。"+this.props.joinField1.name+":"+joinValue1+","+this.props.joinField2.name+":"+joinValue2+"。一覧画面更新成功後自動リロードしません。必要に応じて手動リロードください。"); + window.alert("文字結合には、一覧画面更新成功後自動リロードしません。必要に応じて手動リロードください。"); + } } ////////////////////////////////////////////////////////////////////////////////////////////////////// result= {