Supista
Contact Us
documentation
Supista ERP
Parameters
API Operations
Fetch Users

Fetch Users

Retrieve user records by providing a list of user IDs.
This function internally queries the database using Sequelize dataModel.findAll().


Usage

const usersData = await fetchUsers(payload);

Payload Structure

The payload object must contain a list of user IDs:

{
  usersList: [1, 3, 5] // Array of user IDs
}

Parameter Details

usersList (Required)

An array of numeric user IDs to retrieve.

usersList: [1, 3, 5]

Return Value

Returns a list of user records from the database.

Sample Output

[
  {
    columnName1: "columnValue1",
    columnName2: "columnValue2",
    columnName3: "columnValue3"
  },
  {
    columnName1: "columnValue1",
    columnName2: "columnValue2",
    columnName3: "columnValue3"
  }
]

Example Implementation

async function customizeERP(userData, apiOperations) {
  return new Promise(async (resolve, reject) => {
 
    const payload = {
      usersList: userData.usersList
    };
 
    const rowsData = await fetchUsers(payload);
 
    if (rowsData) {
      resolve({ result: rowsData });
    } else {
      resolve({
        result: {},
        popupMsg: {
          type: "error",
          message: "Could Not read data! Please try again later"
        }
      });
    }
 
  });
}

Example Input

{
  "usersList": [1]
}

Example Output

{
  "response": {
    "__d3__result": {
      "result": [
        {
          "id": 1,
          "userID": 1,
          "emailID": "johnDoe@gmail.com",
          "role": ["Admin"],
          "ITStakeholder": ["ITAdmin"],
          "erpRole": ["Admin"],
          "firstName": "joh",
          "lastName": "doe",
          "phone": "(+011) 9999999999",
          "addedByUserID": null,
          "addedByEmailID": null,
          "userInfo": {
            "manager": [],
            "coach": [],
            "subordinates": [[2, 3]],
            "coachees": [[2, 3]]
          },
          "manager": null,
          "coach": null,
          "__d3__createdAt": "2025-04-19T10:45:47.057Z",
          "__d3__updatedAt": "2025-05-24T16:19:11.541Z",
          "__d3__deletedAt": null
        }
      ]
    },
    "__d3__error": false,
    "printConsole": []
  }
}
Transform Data into Decisions with Supista – Your Intelligent Data Partner
AI-Powered Operational Intelligence for Growing Businesses

Automate your operations. Orchestrate your workflows. Scale with confidence.

Book a free strategy session with our Automation Experts and discover how Supista’s AI-Composable ERP can transform your operations into a scalable and intelligent system.