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") |
|||
|
|||
module.exports = async function saveRecord(args) { |
|||
module.exports = async function saveRecord({ args, instanceId }) { |
|||
const { model, ...record } = args.record |
|||
|
|||
const ctx = { |
|||
params: { |
|||
instanceId: "inst_60dd510_700f7dc06735403e81d5af91072d7241", |
|||
instanceId, |
|||
modelId: model._id, |
|||
}, |
|||
request: { |
|||
body: args.record, |
|||
body: record, |
|||
}, |
|||
} |
|||
|
|||
await recordController.save(ctx) |
|||
|
|||
return { |
|||
record: ctx.body, |
|||
try { |
|||
return { |
|||
record: ctx.body, |
|||
} |
|||
} catch (err) { |
|||
console.error(err) |
|||
return { |
|||
record: null, |
|||
error: err.message, |
|||
} |
|||
} |
|||
} |
|||
|
|||
Loading…
Reference in new issue