BUg550 再テスト後、文字列フィールド以外に、変数nullを挿入しようとした場合のエラーメッセージ修正 、Bug540 再テスト後、保存成功時に変数の値が挿入されないのを修正
This commit is contained in:
@@ -75,9 +75,11 @@ export class InsertValueAction implements IAction{
|
|||||||
checkVariableValueBlank(fieldType :string | undefined,inputValueArray :any,fieldCode :string,fieldRequired :boolean | undefined,event :any): boolean{
|
checkVariableValueBlank(fieldType :string | undefined,inputValueArray :any,fieldCode :string,fieldRequired :boolean | undefined,event :any): boolean{
|
||||||
|
|
||||||
let blankCheck;
|
let blankCheck;
|
||||||
//正規表現チェック
|
if(inputValueArray === null && fieldType !== "SINGLE_LINE_TEXT" && fieldType !== "MULTI_LINE_TEXT" && fieldType !== "RICH_TEXT" && fieldType !== "LINK"){
|
||||||
for(let i =0;i<inputValueArray.length;i++){
|
//正規表現チェック
|
||||||
blankCheck = inputValueArray[i].match(/^(\s| )*$/);//空文字・半角スペース・タブ文字・改行・改ページ・全角スペース
|
for(let i =0;i<inputValueArray.length;i++){
|
||||||
|
blankCheck = inputValueArray[i].match(/^(\s| )*$/);//空文字・半角スペース・タブ文字・改行・改ページ・全角スペース
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(blankCheck !== null){
|
if(blankCheck !== null){
|
||||||
@@ -349,7 +351,6 @@ export class InsertValueAction implements IAction{
|
|||||||
//ユーザー選択フィールドに挿入時、ユーザーオブジェクトのcodeを代入する
|
//ユーザー選択フィールドに挿入時、ユーザーオブジェクトのcodeを代入する
|
||||||
if(fieldType.includes('USER_SELECT')){
|
if(fieldType.includes('USER_SELECT')){
|
||||||
//変数の値取得
|
//変数の値取得
|
||||||
// variableValue = getContextVarByPath(context.variables,inputValue);
|
|
||||||
if(!Array.isArray(objectValue)){
|
if(!Array.isArray(objectValue)){
|
||||||
variableValue.push(objectValue.code);
|
variableValue.push(objectValue.code);
|
||||||
}else{
|
}else{
|
||||||
@@ -475,7 +476,6 @@ export class InsertValueAction implements IAction{
|
|||||||
const getContextVarByPath = (obj: any, path: string) => {
|
const getContextVarByPath = (obj: any, path: string) => {
|
||||||
return path.split(".").reduce((o, k) => (o || {})[k], obj);
|
return path.split(".").reduce((o, k) => (o || {})[k], obj);
|
||||||
};
|
};
|
||||||
|
|
||||||
//オブジェクト変数で、値の指定がある場合は、変数名のみ取得
|
//オブジェクト変数で、値の指定がある場合は、変数名のみ取得
|
||||||
var variablesName = fieldValue.substr(0, fieldValue.indexOf('.'));
|
var variablesName = fieldValue.substr(0, fieldValue.indexOf('.'));
|
||||||
if(variablesName){
|
if(variablesName){
|
||||||
@@ -486,6 +486,12 @@ export class InsertValueAction implements IAction{
|
|||||||
objectValue = getContextVarByPath(context.variables,fieldValue)
|
objectValue = getContextVarByPath(context.variables,fieldValue)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//文字列型のフィールド以外に、空白文字の変数の値を挿入する場合、エラーを出す
|
||||||
|
if(fieldType !== "SINGLE_LINE_TEXT" && fieldType !== "MULTI_LINE_TEXT" && fieldType !== "RICH_TEXT" && fieldType !== "LINK"
|
||||||
|
&& objectValue === null){
|
||||||
|
throw new Error("「"+fieldCode+"」"+"フィールドに挿入しようとした変数は、値がnullのため、処理を中断しました。");
|
||||||
|
}
|
||||||
|
|
||||||
//オブジェクト変数の場合、プロパティを取得し、何のオブジェクト変数か判断する
|
//オブジェクト変数の場合、プロパティを取得し、何のオブジェクト変数か判断する
|
||||||
if(objectValue !== null && typeof objectValue === 'object'){
|
if(objectValue !== null && typeof objectValue === 'object'){
|
||||||
let objectProperties=[]
|
let objectProperties=[]
|
||||||
@@ -510,8 +516,8 @@ export class InsertValueAction implements IAction{
|
|||||||
fieldValueArray[0] = variableValue;
|
fieldValueArray[0] = variableValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
//変数がfieldValueArrayに代入できなかった場合は、エラーを出す
|
//変数がfieldValueArrayに代入できなかった場合、エラーを出す
|
||||||
if(objectValue === undefined && fieldValueArray === undefined){
|
if(fieldValueArray === undefined){
|
||||||
throw new Error("「"+fieldCode+"」"+"フィールドに入れようとした変数は、無効な入力形式です。");
|
throw new Error("「"+fieldCode+"」"+"フィールドに入れようとした変数は、無効な入力形式です。");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -656,7 +662,13 @@ export class InsertValueAction implements IAction{
|
|||||||
}
|
}
|
||||||
|
|
||||||
//kintone async/await による非同期処理(レコード更新)
|
//kintone async/await による非同期処理(レコード更新)
|
||||||
await updateRecord(fieldCode,event,correctFormattedValue);
|
if(correctFormattedValue){
|
||||||
|
await updateRecord(fieldCode,event,correctFormattedValue);
|
||||||
|
//条件式の結果がtureかつ、値を正しい形式(配列)に変換できた場合、フィールドに値(配列)をセットする
|
||||||
|
}else if(correctValues.length > 0){
|
||||||
|
await updateRecord(fieldCode,event,correctValues);
|
||||||
|
}
|
||||||
|
// await updateRecord(fieldCode,event,correctFormattedValue);
|
||||||
};
|
};
|
||||||
|
|
||||||
result= {
|
result= {
|
||||||
|
|||||||
Reference in New Issue
Block a user