• Emmanuel Petrelli 23
  • NEWBIE
  • 10 Points
  • Member since 2018

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 1
    Likes Given
  • 2
    Questions
  • 0
    Replies
Hi all, 

is there a way to prevent to refresh a Lightning Component until the session expires?

I would like to keep the state of the component (for example a input table), even if I later navigate to another tab or other component.
The component that was loaded the first time, must not be refreshed until the SF session expires or until it is updated manually.


Is it feasible in Salesforce without using DML operations?
Thanks in advance!    
I would like to receive information regarding the Error: "An internal server error has occurred Error ID: 435276104-25533 (-2090061783)"

This error appears when, by pressing a button in a lightning component, I call a method @AuraEnabled and in this method I do 2 DML-deletion: one for the PermissionSetAssignments and one for the PermissionSets.

Method:
       @AuraEnabled
    public static String deleteExistingCBAPermissionSets(){
       try{
            map<Id,PermissionSet> mapIdToPermissionSet = new map<Id,PermissionSet>();
            for(PermissionSet ps : [Select Name, Label from PermissionSet where Name like 'CBA_%']){
                mapIdToPermissionSet.put(ps.Id, ps);
            }
            list<PermissionSetAssignment> permissionsSetAssignToDelete = new list<PermissionSetAssignment>();
            for(PermissionSetAssignment psa : [Select Id, PermissionSetId
                                                from PermissionSetAssignment
                                                where PermissionSetId IN: mapIdToPermissionSet.keyset()]){
                permissionsSetAssignToDelete.add(psa);
            }
            if(permissionsSetAssignToDelete.size()>0){
                delete permissionsSetAssignToDelete;
            }
            if(mapIdToPermissionSet.size()>0){
                delete mapIdToPermissionSet.values();
            }
            return 'OK';
        }catch (exception e){
            return e.getMessage()+' at line '+e.getLineNumber();
        }

    }

I run the same code from Execute Anonymous and it works correctly. It deletes the desired permissions.
I also tried to declare the class "without sharing" but the result is the same.

Does anyone know the kind of error?
Thanks in advance for your answers.
Actually this is my apex class for addition of 2 numbers 
public class Addition         //define class
{
  public integer a=5;        //define variables
  public integer b=4;
  public integer c;

  public integer add()               //define function or method
  {
  c=a+b;
  system.debug('the result is '+c);
        return c;
  }
}// end of class


My Test class
----------------
@isTest
public class Additiontest
{
    static testmethod void testadd()
    {
     integer a=5;
     integer b=7;
     integer c=12;
     system.assertEquals(12,12); 
    }  
    
}

and when executing the test class it is showing as pass...

Please need help on this....thanks