Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @AuraEnabled
- public static List<AggregateResult> getProfileInfo() {
- List<AggregateResult> plist = new List<AggregateResult>();
- plist = [SELECT Parent.Profile.Name, COUNT(SObjectType) FROM ObjectPermissions
- WHERE (ParentId IN (SELECT PermissionSetId FROM PermissionSetAssignment))
- AND Parent.IsOwnedByProfile = true
- AND (SObjectType IN :sobjectNames)
- GROUP BY Parent.Profile.Name];
- return plist;
- }
- doInit: function(component, event, helper) {
- var cols1 = [
- {label: 'Profile Names', fieldName: 'Name', type: 'text'},
- {label: 'Object Counts', fieldName: 'ObjectName__c', type: 'Integer'}
- ];
- component.set("v.tableCols1", cols1);
- },
- fetchProfileOnly : function(component, event, helper){
- alert('fetchProfileOnly called');
- var action = component.get("c.getProfileInfo");
- alert('*******'+action);
- action.setCallback(this, function(response) {
- var state = response.getState();
- alert('*******'+state);
- if (state === "SUCCESS") {
- alert('inside success');
- var profileWithObjCounts = response.getReturnValue();
- alert('****All Profile*****'+profileWithObjCounts);
- component.find(profileId).set("v.profileList", profileWithObjCounts);
- }
- });
- },
- <aura:component controller="ConfigMonitoring" >
- <aura:handler name="init" value="{!this}" action="{!c.fetchProfileOnly}"/>
- <aura:attribute name="tableCols1" type="List" />
- <aura:attribute name="profileList" type="List"/>
- <div class="slds-card__body slds-card__body_inner" style="margin-top:10px;">
- <lightning:datatable data="{!v.profileList}"
- columns="{!v.tableCols1 }"
- keyField="Id"
- hideCheckboxColumn="true"
- />
- </div>
- </aura:component>
- SELECT Parent.Profile.Name pn, COUNT(SObjectType) oc
- var cols1 = [
- {label: 'Profile Names', fieldName: 'pn', type: 'String'},
- {label: 'Object Counts', fieldName: 'oc', type: 'Integer'}
- ];
Add Comment
Please, Sign In to add comment