countSubmissions( )


Counts the number of submissions belonging to the specified forms.

The countSubmissions() function is useful for analytics and tracking purposes. For example, if you have a contact form on your website, you can use this function to track how many submissions it receives daily, weekly, or monthly.

Authentication
  • When developing websites or building an app with Blocks, this method may require elevated permissions, depending on the identity of the user calling it and the calling user’s permissions.
  • When building apps without Blocks or for headless projects, you can only call this method directly when authenticated as a Wix app or Wix user identity. When authenticated as a different identity, you can call this method using elevation.
  • Elevation permits users to call methods they typically cannot access. Therefore, you should only use it intentionally and securely.
Permissions
Manage Submissions
Read Submissions
Manage Orders
Read Orders
Learn more about app permissions.
Method Declaration
Copy
function countSubmissions(
  formIds: Array<string>,
  namespace: string,
  options: CountSubmissionsOptions,
): Promise<CountSubmissionsResponse>;
Method Parameters
formIdsArray<string>Required

Form IDs which submissions should be counted.


namespacestringRequired

The app which the form submissions belong to. For example, the namespace for the Wix Forms app is wix.form_app.form. Call getSubmission() to retrieve the namespace.


optionsCountSubmissionsOptions
Returns
Return Type:Promise<CountSubmissionsResponse>
JavaScript
import { submissions } from "@wix/forms"; /* Sample formIds value: ["21bcb6c7-02b3-4ed1-b6db-7856094fac03"] Sample namespace value: "wix.form_app.form" */ export async function myCountSubmissionsFunction(formIds, namespace) { try { const formsSubmissionsCount = await submissions.countSubmissions( formIds, namespace, ); console.log("Success! Forms submissions count:", formsSubmissionsCount); return formsSubmissionsCount; } catch (error) { console.error(error); // Handle the error } } /* Promise resolves to: { "formId": "21bcb6c7-02b3-4ed1-b6db-7856094fac03", "totalCount": 4, "unseenCount": 2 } */
Errors

This method doesn’t return any custom errors, but may return standard errors. Learn more about standard Wix errors.

Did this help?