Editing the 'Form and Dataset Brick'
Hi,
I am trying to create a form to collect 3 fields from the User and have it write back to a dataset.
I downloaded the 'Form and Dataset Brick' since it does most of the heavy lifting for you, but anytime I edit anything in the JS like delete the table function or the search function the entire app messes up and I cannot figure out why. I then downloaded a blank brick and tried to set up a collection and but that also didnt work. Ive tried to read this https://developer.domo.com/portal/1l1fm2g0sfm69-app-db-api#create-document
but it doesn't make much sense to me since I am not a web developer. Any help or guidance would be very appreciated!
Best Answer
-
I don't think Domo will allow you to write JavaScript in the browser that can post back to the dataset. You would need a backend service to receive the data from the user and then use the Domo API to write to the dataset. Something like the following.
const express = require('express');
const axios = require('axios');
const bodyParser = require('body-parser');
const app = express();
app.use(bodyParser.json());
const domoApiUrl = 'https://api.domo.com';
const datasetId = '<Your Dataset ID>';
const accessToken = '<Your OAuth Access Token>';
app.post('/submit-data', async (req, res) => {
const { field1, field2, field3 } = req.body;
try {
const response = await axios.post(
`${domoApiUrl}/v1/datasets/${datasetId}/data`,
[
{
"Field 1": field1,
"Field 2": field2,
"Field 3": field3
}
],
{
headers: {
'Authorization': `Bearer ${accessToken}`,
'Content-Type': 'application/json'
}
}
);
res.status(200).send('Data successfully submitted to Domo!');
} catch (error) {
res.status(500).send('Error submitting data to Domo.');
}
});
app.listen(3000, () => {
console.log('Server is running on port 3000');
});** Was this post helpful? Click Agree or Like below. **
** Did this solve your problem? Accept it as a solution! **0
Answers
-
Thanks for reaching out to our community forum.
To help us investigate more thoroughly, please open a support case. Our team will be happy to assist you further. When submitting the case, please include relevant details such as URL of brick, screenshots, and any error messages you're encountering. This information will help us understand the issue better and provide a timely solution.
0 -
I don't think Domo will allow you to write JavaScript in the browser that can post back to the dataset. You would need a backend service to receive the data from the user and then use the Domo API to write to the dataset. Something like the following.
const express = require('express');
const axios = require('axios');
const bodyParser = require('body-parser');
const app = express();
app.use(bodyParser.json());
const domoApiUrl = 'https://api.domo.com';
const datasetId = '<Your Dataset ID>';
const accessToken = '<Your OAuth Access Token>';
app.post('/submit-data', async (req, res) => {
const { field1, field2, field3 } = req.body;
try {
const response = await axios.post(
`${domoApiUrl}/v1/datasets/${datasetId}/data`,
[
{
"Field 1": field1,
"Field 2": field2,
"Field 3": field3
}
],
{
headers: {
'Authorization': `Bearer ${accessToken}`,
'Content-Type': 'application/json'
}
}
);
res.status(200).send('Data successfully submitted to Domo!');
} catch (error) {
res.status(500).send('Error submitting data to Domo.');
}
});
app.listen(3000, () => {
console.log('Server is running on port 3000');
});** Was this post helpful? Click Agree or Like below. **
** Did this solve your problem? Accept it as a solution! **0
Categories
- All Categories
- 1.8K Product Ideas
- 1.8K Ideas Exchange
- 1.6K Connect
- 1.2K Connectors
- 300 Workbench
- 6 Cloud Amplifier
- 9 Federated
- 2.9K Transform
- 102 SQL DataFlows
- 626 Datasets
- 2.2K Magic ETL
- 3.9K Visualize
- 2.5K Charting
- 753 Beast Mode
- 61 App Studio
- 41 Variables
- 692 Automate
- 177 Apps
- 456 APIs & Domo Developer
- 49 Workflows
- 10 DomoAI
- 38 Predict
- 16 Jupyter Workspaces
- 22 R & Python Tiles
- 398 Distribute
- 115 Domo Everywhere
- 276 Scheduled Reports
- 7 Software Integrations
- 130 Manage
- 127 Governance & Security
- 8 Domo Community Gallery
- 38 Product Releases
- 11 Domo University
- 5.4K Community Forums
- 40 Getting Started
- 30 Community Member Introductions
- 110 Community Announcements
- 4.8K Archive