bugfix for auto-lookup
This commit is contained in:
@@ -103,7 +103,7 @@ export class AutoLookUpAction implements IAction {
|
||||
this.actionProps = actionNode.actionProps;
|
||||
this.props = {
|
||||
...actionNode.ActionValue,
|
||||
condition: JSON.parse((actionNode.ActionValue as any).condition),
|
||||
condition: JSON.parse((actionNode.ActionValue as any).condition || '{}'),
|
||||
} as IAutoLookUpProps;
|
||||
// console.log(context);
|
||||
|
||||
@@ -111,16 +111,17 @@ export class AutoLookUpAction implements IAction {
|
||||
canNext: true,
|
||||
result: "",
|
||||
} as IActionResult;
|
||||
try {
|
||||
const lookUpFields = this.props.lookupField.fields.filter(
|
||||
(f) => f.lookup && f.lookup.relatedApp.app === String(kintone.app.getId())
|
||||
const lookUpFields = this.props.lookupField.fields.filter(
|
||||
(f) => f.lookup && f.lookup.relatedApp.app === String(kintone.app.getId())
|
||||
);
|
||||
if (!lookUpFields || lookUpFields.length===0) {
|
||||
throw new Error(
|
||||
`ルックアップの設定は不正です。${this.props.lookupField.fields[0].label} `
|
||||
);
|
||||
if (!lookUpFields || lookUpFields.length===0) {
|
||||
throw new Error(
|
||||
`ルックアップの設定は不正です。${this.props.lookupField.fields[0].label} `
|
||||
);
|
||||
}
|
||||
}
|
||||
try {
|
||||
const lookUpField = this.props.lookupField.fields[0];
|
||||
this.showSpinnerModel(this.props.lookupField.app, lookUpField);
|
||||
const key = event.record[lookUpField.lookup.relatedKeyField].value;
|
||||
const targetRecords = await this.getUpdateRecords(lookUpField, key);
|
||||
//更新対象がない時にスキップ
|
||||
@@ -129,7 +130,6 @@ export class AutoLookUpAction implements IAction {
|
||||
}
|
||||
const updateRecords = this.convertForLookup(targetRecords,lookUpField,key);
|
||||
console.log("updateRecords", updateRecords);
|
||||
this.showSpinnerModel(this.props.lookupField.app,lookUpField);
|
||||
const updateResult = await this.updateLookupTarget(updateRecords);
|
||||
if(updateResult){
|
||||
this.showResult(this.props.lookupField.app,lookUpField,updateRecords.length);
|
||||
@@ -157,7 +157,7 @@ export class AutoLookUpAction implements IAction {
|
||||
if(typeof key==='string'){
|
||||
query = `${lookUpField.code} = "${key}"`
|
||||
}
|
||||
if(this.props.condition.queryString!==''){
|
||||
if(!!this.props.condition.queryString){
|
||||
query = `${query} and (${this.props.condition.queryString})`
|
||||
}
|
||||
return query;
|
||||
|
||||
Reference in New Issue
Block a user