forked from tsai/budibase
14 changed files with 98 additions and 119 deletions
@ -1,9 +0,0 @@ |
|||||
export default async function() { |
|
||||
const response = await fetch("www.google.com") |
|
||||
console.log(response) |
|
||||
console.log("CUSTOM ACTION") |
|
||||
return { |
|
||||
message: "CUSTOM_WORKFLOW_SCRIPT", |
|
||||
response, |
|
||||
} |
|
||||
} |
|
||||
@ -1,18 +1,29 @@ |
|||||
const recordController = require("../../record") |
const recordController = require("../../record") |
||||
|
|
||||
module.exports = async function saveRecord(args) { |
module.exports = async function saveRecord({ args, instanceId }) { |
||||
|
const { model, ...record } = args.record |
||||
|
|
||||
const ctx = { |
const ctx = { |
||||
params: { |
params: { |
||||
instanceId: "inst_60dd510_700f7dc06735403e81d5af91072d7241", |
instanceId, |
||||
|
modelId: model._id, |
||||
}, |
}, |
||||
request: { |
request: { |
||||
body: args.record, |
body: record, |
||||
}, |
}, |
||||
} |
} |
||||
|
|
||||
await recordController.save(ctx) |
await recordController.save(ctx) |
||||
|
|
||||
return { |
try { |
||||
record: ctx.body, |
return { |
||||
|
record: ctx.body, |
||||
|
} |
||||
|
} catch (err) { |
||||
|
console.error(err) |
||||
|
return { |
||||
|
record: null, |
||||
|
error: err.message, |
||||
|
} |
||||
} |
} |
||||
} |
} |
||||
|
|||||
Loading…
Reference in new issue