queryCreateRequests( )


Creates a query to retrieve a list of create requests.

Notes:

  • This function is only relevant if admin approval is required for creating a group, or if the function's suppressAuth option is set to true.
  • For SECRET groups, only site admins can query requests to create a group. However, if the suppressAuth option is set to true, all permissions are overwritten, and all site members can query requests to create secret groups.

The queryCreateRequests() function builds a query to retrieve a list of all requests to create a group, and returns a CreateRequestsQueryBuilder object.

The returned object contains the query definition which is typically used to run the query using the find() function.

You can refine the query by chaining CreateRequestsQueryBuilder functions onto the query. CreateRequestsQueryBuilder functions enable you to sort, filter, and control the results that queryCreateRequests() returns.

queryCreateRequests() runs with these CreateRequestsQueryBuilder defaults, which you can override:

The following CreateRequestsQueryBuilder functions are supported for queryCreateRequests(). For a full description of the CreateRequests object, see the object returned for the items property in CreateRequestsQueryResult.

PropertySupported Filters & Sorting
statuseq(), ne(), hasSome(), or()
_createdDateascending(), descending()
Method Declaration
Copy
function queryCreateRequests(): CreateRequestsQueryBuilder;
Request
This method does not take any parameters
Returns
Query requests to create a group
JavaScript
import { Permissions, webMethod } from "wix-web-module"; import { createRequests } from "wix-groups-backend"; export const myQueryCreateRequestsFunction = webMethod( Permissions.Anyone, () => { return createRequests .queryCreateRequests() .find() .then((results) => { const items = results.items; const firstItem = items[0]; const pageSize = results.pageSize; const totalPages = results.totalPages; const totalCount = results.totalCount; const currentPage = results.currentPage(); const next = results.next(); const previous = results.prev(); const hasNext = results.hasNext(); const hasPrev = results.hasPrev(); const length = results.length; return items; }) .catch((error) => { console.error(error); }); }, ); /* Returns items: * { * "_id": "83636377-b415-4ebe-ba41-df338c5ad6b7" * "status": "PENDING", * "group": { * "_id": "83636377-b415-4ebe-ba41-df338c5ad6b7" * "name": "My Group Request 1" * "slug": "my-group-request-1" * "description": "Welcome to the group! You can connect with other members, get updates and share videos." * "privacyStatus": "PUBLIC" * "coverImage": { * "imageUrl": "wix:image://v1/ff9074e348009011fa9f2dzcvx22~mv2.jpg/fossil.jpg#originWidth=800&originHeight=720", * "position": { * "x": 9, * "y": 4 * } * } * "memberTitle": "Employees" * "memberCount": 1 * "settings": { * "groupUpdatePostEnabled": true * "membersCanApprove": false * "membersCanInvite": true * "showMemberList": true * "welcomeMemberPostEnabled": true * } * "lastActivityDate": "Sun Sep 26 2021 08:23:23 GMT+0300" * "_createdDate": "Tues January 22 2021 12:56:02 GMT+0300" * "_updatedDate": "Fri October 2 2021 04:56:22 GMT+0300" * "owner": "9ne8e9e1-d050-4c86-9684-e7f231600a34" * } * }, * { * "_id": "6ff5333-b477-4e9tt-ba4j-df338c5ad6221" * "status": "APPROVED", * "group": { * "_id": "6ff5333-b477-4e9tt-ba4j-df338c5ad6221" * "name": "My Group Request 2" * "slug": "my-group-request-2" * "description": "Welcome to the group! You can connect with other members, get updates and share videos." * "privacyStatus": "PRIVATE" * "coverImage": { * "imageUrl": "wix:image://v1/ef9074e348009011fa9f2dzcvx22~mv2.jpg/house.jpg#originWidth=559&originHeight=399", * "position": { * "x": 30, * "y": 225 * } * } * "memberTitle": "Friends" * "memberCount": 65 * "settings": { * "groupUpdatePostEnabled": true * "membersCanApprove": true * "membersCanInvite": true * "showMemberList": false * "welcomeMemberPostEnabled": true * } * "lastActivityDate": "Thurs Nov 12 2020 11:13:03 GMT+0300" * "_createdDate": "Wed May 14 2020 10:05:20 GMT+0300" * "_updatedDate": "Sun June 7 2020 09:07:33 GMT+0300" * "owner": "abe5e4e1-d950-4c46-8884-e7f231600d67" * } * } * "_id": "57vn211-b477-4e9tt-ba4j-df338c5adf337" * "status": "REJECTED" * "rejectionReason": "This group has inappropriate content.", * "group": { * "_id": "57vn211-b477-4e9tt-ba4j-df338c5adf337" * "name": "My Group Request 3" * "slug": "my-group-request-3" * "description": "Welcome to the group! You can connect with other members, get updates and share videos." * "privacyStatus": "PRIVATE" * "coverImage": { * "imageUrl": "wix:image://v1/ff9074e348009011fa9f2dzcvx22~mv2.jpg/friends.jpg#originWidth=4494&originHeight=2248", * "position": { * "x": 36, * "y": 87 * } * } * "memberTitle": "Students" * "memberCount": 1 * "settings": { * "groupUpdatePostEnabled": true * "membersCanApprove": true * "membersCanInvite": true * "showMemberList": false * "welcomeMemberPostEnabled": true * } * "lastActivityDate": "Mon Feb 04 2019 01:19:53 GMT+0300" * "_createdDate": "Mon Feb 04 2019 01:19:53 GMT+0300" * "_updatedDate": "Mon Feb 04 2019 01:19:53 GMT+0300" * "owner": "abe5e4e1-d950-4c46-8884-e7f231600d67" * } * } * ] */
Errors

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

Did this help?