UNPKG

salesforce-alm

Version:

This package contains tools, and APIs, for an improved salesforce.com developer experience.

40 lines (38 loc) 1.13 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.CommunitiesServices = void 0; /** * Helper services for Communities */ class CommunitiesServices { /** * Get community name from the given id * * @param org - the org to query * @param name - the given community name * * @returns - the community id for the given name */ static async fetchCommunityInfoFromName(org, name) { if (!name) { return Promise.resolve(undefined); } const result = await CommunitiesServices.runQuery(org, `SELECT Id, Status FROM NETWORK WHERE NAME = '${name}'`); if (result.totalSize > 0) { const record = result.records[0]; return { name, id: record['Id'], status: record['Status'], }; } } static async runQuery(org, query) { if (!query) { return; } return org.getConnection().query(query); } } exports.CommunitiesServices = CommunitiesServices; //# sourceMappingURL=CommunitiesServices.js.map