You need to sign in to do that
Don't have an account?
I want to use the permission set in the LWC component while I login with another user who are in permission set then my lwc component is not working. Where is the issue.I just make the this.mainbutton true, If I login with user who are in permission set
public with sharing class pia_Locked_Validation {
@AuraEnabled(cacheable=true)
public static list<string> getRecordIds(Id caseId) {
system.debug('rcordid>>>>>>>>>>'+caseId);
list<string>pmList1= new list<string>();
User currentuser =new User();
currentuser=[Select Id,Name,Email from User where Id=:userinfo.getuserId()];
system.debug('currentUser'+currentuser.Id);
for(PermissionSetAssignment pm1:[SELECT Id,AssigneeId, PermissionSet.Name FROM PermissionSetAssignment WHERE PermissionSet.Name ='Privacy_Community_Kinesso_Viewing_Approval_Permission_Set']){
system.debug('PermissionSetAssignment1'+pm1.PermissionSet.Name);
if(pm1.AssigneeId==currentuser.Id){
system.debug('PermissionSetAssignmentIF1'+pm1.AssigneeId);
pmList1.add(pm1.PermissionSet.Name);
}
}
for(PermissionSetAssignment pm2:[SELECT Id,AssigneeId, PermissionSet.Name FROM PermissionSetAssignment WHERE PermissionSet.Name ='Privacy_Community_Checkbox_on_Case_Fields']){
system.debug('PermissionSetAssignment2'+pm2.AssigneeId);
if(pm2.AssigneeId==currentuser.Id){
system.debug('PermissionSetAssignmentIF2'+pm2.AssigneeId);
pmList1.add(pm1.PermissionSet.Name);
}
}
system.debug('zthis is return'+pmList1);
return pmList1;
}
}
LWC COMPOENTN BELOW----------------------------------->>>>>>>>>
wiredObjectInfo({data, error}) {
if (data) {
console.log('ObjectInfo' + data.length);
if(data.length>0){
this.mainButton= true;
}
this.error = undefined;
} else if (error) {
this.error = error;
}
}
@AuraEnabled(cacheable=true)
public static list<string> getRecordIds(Id caseId) {
system.debug('rcordid>>>>>>>>>>'+caseId);
list<string>pmList1= new list<string>();
User currentuser =new User();
currentuser=[Select Id,Name,Email from User where Id=:userinfo.getuserId()];
system.debug('currentUser'+currentuser.Id);
for(PermissionSetAssignment pm1:[SELECT Id,AssigneeId, PermissionSet.Name FROM PermissionSetAssignment WHERE PermissionSet.Name ='Privacy_Community_Kinesso_Viewing_Approval_Permission_Set']){
system.debug('PermissionSetAssignment1'+pm1.PermissionSet.Name);
if(pm1.AssigneeId==currentuser.Id){
system.debug('PermissionSetAssignmentIF1'+pm1.AssigneeId);
pmList1.add(pm1.PermissionSet.Name);
}
}
for(PermissionSetAssignment pm2:[SELECT Id,AssigneeId, PermissionSet.Name FROM PermissionSetAssignment WHERE PermissionSet.Name ='Privacy_Community_Checkbox_on_Case_Fields']){
system.debug('PermissionSetAssignment2'+pm2.AssigneeId);
if(pm2.AssigneeId==currentuser.Id){
system.debug('PermissionSetAssignmentIF2'+pm2.AssigneeId);
pmList1.add(pm1.PermissionSet.Name);
}
}
system.debug('zthis is return'+pmList1);
return pmList1;
}
}
LWC COMPOENTN BELOW----------------------------------->>>>>>>>>
wiredObjectInfo({data, error}) {
if (data) {
console.log('ObjectInfo' + data.length);
if(data.length>0){
this.mainButton= true;
}
this.error = undefined;
} else if (error) {
this.error = error;
}
}
Are you seeing any error messages when the other user who is having the same permission set is accessing the LWC component? Thanks