SELECT Status, COUNT(id) numRecs FROM Case GROUP BY Status;
// replace Case with the appropriate object
Schema.DescribeSObjectResult dsr = Case.sObjectType.getDescribe();
Map fieldMap = dsr.fields.getMap();
for (String fieldName : fieldMap.keySet())
{
System.debug('%' + dsr.getName() + '% Label: %' + fieldMap.get(fieldName).getDescribe().getLabel() + '% Field Name: %' + fieldName);
}
List gd = Schema.getGlobalDescribe().Values();
for(Schema.SObjectType f : gd)
{
System.debug(f.getDescribe().getLabel());
}
PageReference pr=new PageReference('/changemgmt/listOutboundChangeSet.apexp');
Blob output=pr.getContent();
System.debug('### Content = \n' + output.toString());
public static String GetUserIPAddress() {
string ReturnValue = '';
// True-Client-IP has the value when the request is coming via the caching integration.
ReturnValue = ApexPages.currentPage().getHeaders().get('True-Client-IP');
// X-Salesforce-SIP has the value when no caching integration or via secure URL.
if (ReturnValue == '' || ReturnValue == null) {
ReturnValue = ApexPages.currentPage().getHeaders().get('X-Salesforce-SIP');
} // get IP address when no caching (sandbox, dev, secure urls)
if (ReturnValue == '' || ReturnValue == null) {
ReturnValue = ApexPages.currentPage().getHeaders().get('X-Forwarded-For');
} // get IP address from standard header if proxy in use
return ReturnValue;
} // GetUserIPAddress
String queueExt = '69381';
CTI_Case_Queue__mdt[] queueMapping = [SELECT MasterLabel, Label, DeveloperName, Queue_Extension__c, Queue_Name__c
FROM CTI_Case_Queue__mdt
WHERE Queue_Extension__c = :queueExt];
System.debug('==== queueExt: ' + queueExt);
System.debug('==== num of records: ' + queueMapping.size());
for(CTI_Case_Queue__mdt q : queueMapping)
{
System.debug('==== MasterLabel: ' + q.MasterLabel);
System.debug('==== Label: ' + q.Label);
System.debug('==== DeveloperName: ' + q.DeveloperName);
System.debug('==== Queue_Extension__c: ' + q.Queue_Extension__c);
System.debug('==== Queue_Name__c: ' + q.Queue_Name__c);
}
if (!documentIdsList.isEmpty()) { // add the document to the unpublished library first.
Id internalLibraryId = FDICUtil.getLibraryId('EDOS Community - Unpublished Files');
ContentWorkspace internalLib = [Select Id FROM ContentWorkspace WHERE NAME = 'EDOS Community - Unpublished Files'];
if (internalLibraryId != null) {
// link the file to the unpublished library by default. When the order gets published the file will be
// shared with t he published library. We can remove the share with the public library but we can't remove it from
// the unpublished library since that was the first library the file was shared with. By defualt the first library
// the document gets linked to is the owner of that library, so link it to the unpublished library first.
for (Id docId: documentIdsList) {
//ContentWorkspaceDoc cwd = new ContentWorkspaceDoc(ContentDocumentId = docId, ContentWorkspaceId = internalLibraryId);
ContentWorkspaceDoc cwd = new ContentWorkspaceDoc(ContentDocumentId = docId, ContentWorkspaceId = internalLib.Id);
addToLibraryList.add(cwd);
}
}
if (!addToLibraryList.isEmpty()) {
insert addToLibraryList;
}
}
Set results = new Set();
for( ChildRelationship r: Case.SObjectType.getDescribe().getChildRelationships()) {
results.add(string.valueOf(r.getChildSObject()));
}
system.debug(string.join(new List(results), ', '));
List<Metadata.Metadata> accountLayout = Metadata.Operations.retrieve(Metadata.MetadataType.Layout, new List<String> {'Account-Account Layout'});
Map<String, List<String>> layoutFieldsMap = new Map<String, List<String>>();
List<String> fields = new List<String>();
System.debug('accountLayouts: ' + accountLayout);
Metadata.Layout layoutMd = (Metadata.Layout) accountLayout.get(0);
for (Metadata.LayoutSection section : layoutMd.layoutSections) {
System.debug('Section: ' + section.label);
for (Metadata.LayoutColumn column : section.layoutColumns) {
if (column.layoutItems != null) {
for (Metadata.LayoutItem item : column.layoutItems) {
System.debug('Field: ' + item.field);
fields.add(item.field);
}
}
layoutFieldsMap.put(section.label, fields);
fields.clear();
}
}
System.debug('fields map: ' + layoutFieldsMap); //fields is getting nulled out. figure it out.
for(String key : layoutFieldsMap.keySet()){
List<String> f = layoutFieldsMap.get(key);
System.debug('key: ' + key);
System.debug('f: ' + f);
}
//Get list of what limits are available.
List<System.OrgLimit> limits = OrgLimits.getAll();
for (System.OrgLimit aLimit: limits) {
System.debug('Limit Name ' + aLimit.getName());
}
Map<String,System.OrgLimit> limitsMap = OrgLimits.getMap();
System.OrgLimit dataStorageLimit = limitsMap.get('DataStorageMB');
System.OrgLimit fileStorageLimit = limitsMap.get('FileStorageMB');
// Max and usage limit values of dataStorageLimit
System.debug('dataStorageLimit Value: ' + dataStorageLimit.getValue());
System.debug('Maximum Limit: ' + dataStorageLimit.getLimit());
// Max and usage limit values of fileStorageLimit
System.debug('fileStorageLimit Value: ' + fileStorageLimit.getValue());
System.debug('Maximum Limit: ' + fileStorageLimit.getLimit());
SELECT PermissionSet.Name, Count(Id)
FROM PermissionSetAssignment
WHERE Assignee.isActive = true
AND PermissionSet.IsOwnedByProfile = false
GROUP BY PermissionSet.Name
ORDER BY Count(Id) DESC
SELECT count(Id), Profile.Name
FROM User
GROUP BY Profile.Name /* NOTE: make sure to filter by active users if you want only active users */
SELECT Parent.Profile.Name, Parent.Label, Parent.IsOwnedByProfile, SobjectType, PermissionsRead, PermissionsCreate, PermissionsEdit,
PermissionsDelete, PermissionsViewAllRecords, PermissionsModifyAllRecords
FROM ObjectPermissions
ORDER BY Parent.Profile.Name, Parent.Label, SobjectType
SELECT Parent.Profile.Name, Parent.Label, Parent.IsOwnedByProfile, SobjectType, Field, PermissionsEdit, PermissionsRead
FROM FieldPermissions
ORDER BY Parent.Profile.Name, Parent.Label, SobjectType, Field
SELECT Id, ApplicationId, Name, Label, Type FROM AppMenuItem WHERE type='TabSet'
/* NOTE: remove where clause to see all application types (Network, Connected Apps, etc.). TabSet is for Salesforce Apps created for users */
SELECT Id, SetupEntityId, ParentId, Parent.Label, Parent.IsCustom, Parent.IsOwnedByProfile, Parent.ProfileId, Parent.Profile.Name
FROM SetupEntityAccess
WHERE SetupEntityType = 'TabSet'
AND Parent.IsOwnedByProfile = true
ORDER BY Parent.ProfileId
ConnectApi.OrganizationSettings orgSettings = ConnectApi.Organization.getSettings();
system.debug(orgSettings.UserSettings.currencySymbol);
system.debug(orgSettings.features.defaultCurrencyIsoCode);