Developer guide
Developer guide

Server modules and platform API v1.0

A custom server module exports functions from environment_modules/custom/<module>/index.js. Set wEngine.apiVersion to v1.0 in its package.json. The RPC controller supplies an argument object to each function. Common fields are weSystem, data (request body), session, reqParams, reqQuery, and reqHeaders. Keep browser responses JSON-serializable.

async function getCurrentUser({ weSystem }) {
  return {
    userId: weSystem.getUserId(),
    userName: weSystem.getUserName()
  };
}

module.exports = { getCurrentUser };

Query and change records

weSystem.getQCInstance({ table }) creates a query builder. Add columns, conditions, and a limit before executing. The response has a results array.

const { results } = await weSystem.getQCInstance({ table: 'Application' })
  .addColumns(['Id', 'Name'])
  .addConditions({ column: 'Name', operator: 'equals', value: 'Sales', refId: 'name' })
  .setLimit(20)
  .executeQuery();

Use insertRecords(records, objectName, options), updateRecords(records, objectName, options), and deleteRecords(records, objectName, options) for record changes. Each receives an array of records and an object API name. Query and record operations use the request context for access checks. The query builder also supports setQueryLogic(...); check working/core_engines/queryContainer.js for advanced condition syntax. queryData(query, parameters) and queryMeta(query, parameters, bypassRLS) expose lower-level query paths; use the query builder for ordinary object reads. getQCInstance now accepts bypassFLS as well as bypassRLS and bypassOLS. These options change access behavior and belong only in deliberately privileged server logic.

Identity, access, metadata, and configuration

Need API v1.0 method
Current user getUserId(), getUserName(), getFullName(), getProfileId(), getProfileName()
UI context getSelectedApp(), setSelectedApp(appId), getPageTypeForUrl(url), requestRedirect(url)
Access checks checkAccessForObjects(objectNames), getFieldsAccess(objectName, fields), hasSetupAccess(), getUserMiscPermissions()
Object metadata getObjectFields(objectName)
Organization data getOrganizationConfig(key, namespace), setOrganizationConfig(key, value, namespace)
Labels customLabels

Other exposed methods are executeAutomationUnits(context), submitForApproval(recordIds, objectApiName, comments), and notifyApprovalApprovers(options). Their workflow contracts depend on the configured automation and approval objects; inspect the corresponding implementation before integrating them. The task-specific guides cover triggers, scheduled jobs, and email.

Source: working/platformAPI/v1.0/index.js; custom RPC invocation: working/controllers/rpcController.js.