• sweta kumari 55
  • NEWBIE
  • 0 Points
  • Member since 2021

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 9
    Questions
  • 1
    Replies
I have to show error message on clicking  custom object(objective) New button(Standard Button) .

1)so my condition is if recordId is null 
standard new button while clicking getting eror messgage.

please any one give me solution of this requirment.

 
So when i upload document should be downloadable.
Create a button of download in lwc .when i click download button the file will download which i upload 


any one please with this requirment
public class ApexCollection {
    
public static void apexMethod(string a)
{
    
    String[] arr=new String[]{'A','B','C','D','A'};
        integer s1=integer.valueOf(arr);  
       System.debug( 'intVal value is ' + s1 );

error: Method does not exist or incorrect signature: void apexMethod() from the type ApexCollection.

I am getting error on this code, please response.
How to covert string to integer this list?
List<String> nameArray = new   List<String{'one','two','three','one','one'};

Map<String,Integer> elCount = new Map<String,Integer>();

for(String key : nameArray)
{
    if(!elCount.containsKey(key)){
    elCount.put(key,0);
    }
    Integer currentInt=elCount.get(key)+1;
    elCount.put(key,currentInt);
}


output : 1=>3, 2=>1,3=>1
 
Hi, 
We have to user ,one user have 100 record in account object , I want to share 50 record to another user , How can we do that.



Thanks in advance
 
Hi ,
There is 1000 user and 1000 permission set , So we have to do each one permission set have to assign 1000 user . 

Thanks in Advance

 
Hi All,
Those user record get updated success and those user are not getting update that record created as a  Error record in Error_Log
Here is my code, I am getting inserted any error Log,Please check and let me know the correct logic.
userupdate__c(Custom Setting)
 Error_Log__c (Custom Object)
User(standard Object)

 
public class TestBatchDemo implements Database.Batchable<SObject> 
{     
  public Database.QueryLocator start(Database.BatchableContext bc)   
  {      
   List<userupdate__c> objBatchSize= userupdate__c.getAll().values();    
  List<String> updateuse = new List<string>();       
  for(userupdate__c Au :objBatchSize)
{           
  updateuse.add(Au.UserName__c);           
  System.debug('updateuse'+updateuse);       
  }       
  System.debug('objBatchSize'+objBatchSize);        
 string query = 'select id,UserName,IsActive,firstName from User where UserName Not IN :updateuse';         
System.debug('query'+query);        
 return  Database.getQueryLocator(query);            
  }     public void execute(Database.BatchableContext bc , List<User> UpdateIsActive) 
    {      
  // List< User > Userupda = new List<User>();      
 
    for(User use: UpdateIsActive)     
      {                       
 use.IsActive = false;             
 use.Response__c='Update sucessfully';             
 System.debug('use' +use);                  
  try         {            
Database.update (UpdateIsActive,false);     
       }                     
   catch(exception ex)          
     {                   
List<Error_Log__c> errorLogList  = New List<Error_Log__c>();   
  Error_Log__c log = new Error_Log__c( Object_Name__c  = 'User',Record_Id__c  =use.Id, Request__c =use.Username,   Response__c ='error message'+ex.getMessage());          errorLogList.add(log);       
 Database.SaveResult[] saveResultList = Database.insert(errorLogList, false);                             
     for (Database.SaveResult sr : saveResultList) { 
 if (!sr.isSuccess()) 
{  
System.debug('Successfully inserted error log. error log ID: ' + sr.getId());  }  
else              
   {                   
  for(Database.Error err : sr.getErrors()) {          
   System.debug('The following error has occurred.');                
      System.debug(err.getStatusCode() + ': ' + err.getMessage()); 
 System.debug('REcord fields that  affected this error: ' + err.getFields());  
}  }  }}}}  }          
   public void finish(Database.BatchableContext bc)     {       
  System.debug('Batch is updated');     } }
 
Hi,
 In our organization we have 2000 users, I want to deactivate all the users except Administrator profile users.
 
How can I achieve this with peace of Apex code. If possible Could anyone please provide peace of code to achieve this and how to execute that code.

Thanks
Sweta
How to write test case for this code?

global void execute(SchedulableContext sc){
        Database.executeBatch(new AESL_BatchForSyncMockToErp( setOfErIds ));
        System.abortJob(sc.getTriggerId());
    }
Hi, 
We have to user ,one user have 100 record in account object , I want to share 50 record to another user , How can we do that.



Thanks in advance