Hello Omar,
Thanks for trying. I thought it will work as per this reference I found.
In my opinion, retrieving specific fields when using GET List method is not supported yet. Please submit a new feature request at the Ideas portal to make it feasible in the future: https://domino-ideas.hcltechsw.com/
For the meantime, since you are manipulating JSON response, I would suggest you to utilize the combination of JavaScript fetch command for JSON response, and then utilize JavaScript Array's map to transform JSON data to get only specific fields you need.
Please follow the below steps to apply:
1. First off, you need to make sure secureJS is false in your configuration.
2. Let's say your API format looks like this:
<host_name>/volt-api/secure/org/data/<app_id>/<form_name>?format=application/json
Example:
http://127.0.0.1/volt-api/secure/org/data/6f5ba4b4-6259-4fac-8b34-9fec23a3bf75/F_ApprovedHWSW1?format=application/json
3. Apply example code somewhere in your design element's event:
// create the url for REST call
var formID ="F_ApprovedHWSW1" //make sure the form id matches the form you are going after
var appURL = app.getAppURL();
var apiURLbase = appURL.replace("-apps/landing/org/app", "-api/secure/org/data");
var fetchURL = apiURLbase +"/"+formID+"?format=application/json";
// fetch the JSON data from the form
fetch(fetchURL, {
method: "GET"
}).then((response) => {
response.json().then((jsonResponse) => {
// grab "items" array field in the JSON reponse to get all the data of the form
var items = jsonResponse.items
// retrieve specific fields, for example: F_Category1 and F_Product1 only
var selectedFields = items.map(({F_Category1, F_Product1}) => ({F_Category1, F_Product1}));
// test if new JSON response is only returning fields: F_Category1 and F_Product1
alert(JSON.stringify(selectedFields))
// loop through the "selectedFields" array to get each individual data
for(var i=0;i<selectedFields.length;i++) {
var category = (get(selectedFields,i).F_Category1);
var product = (get(selectedFields,i).F_Product1);
console.log(category)
console.log(product)
}
// close fetch
})});
4. These are the following output:
For reference for the idea I found:
https://hclwiki.atlassian.net/wiki/spaces/HDV/pages/1187610673/HTML+Table+with+fetch+on+App+Page
If you think an answer answered your question, please accept it. It will benefit others having same problem / query.
Hope this helps.
Thanks,
Jayve