• bhuvana das
  • NEWBIE
  • 0 Points
  • Member since 2015

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 1
    Likes Given
  • 1
    Questions
  • 3
    Replies
How to download the "Attachements" which are queried and displaying on custom component. or is there any lightning component for download the attachments (we don't want to use standard things) in napili community template.
Error occurred while trying to proxy request /api/sessions from localhost:3001 to http://localhost:3002 (ECONNREFUSED) (https://nodejs.org/api/errors.html#errors_common_system_errors)
Hi
I have 2 custom objects say Book1 and Book2 and I insert exactly same records in both the objects.
There is no relaitonship between Book1 and Book2.
Both objects have same fields Name and price respectively.
My requirement is when I update a record in Book1, then it should update the matching record in Book2.

I am stuck at the update level, pls help me out
here is the code
public class Book1Scenarios
{
  
  Book2__c book2=new Book2__c();      

//Insert is working
  public void Create(List<Book1__c> book1)
  {
    for(Book1__c b1: book1)
    {
      book2.Name=b1.Name;
      book2.price__c=b1.price__c;
      
    }
    
    insert book2;
   } 
   

// update operation.
   public void UpdateRecord(List<Book1__c> oldbook1)
   {
    List<Book2__c> oldbook2=[select Name,price__c from Book2__c];
    
    for(Book1__c b1:oldbook1)
    {
      for(Book2__c b2:oldbook2)
      {
         if((b1.Name == b2.Name) && (b1.price__c == b2.price__c))
         {
            b2.Name=b1.Name;
            b2.price__c=b1.price__c;
         }
      }
    }
    Database.update(oldbook2);
   }
   
}


trigger trg_Book1Scenarios on Book1__c (after Insert)
{
   Book1Scenarios b1=new Book1Scenarios();
   
   if (trigger.isInsert)
   {
    b1.create(Trigger.New);
   }
   
  if (trigger.isUpdate)
  {
    b1.UpdateRecord(Trigger.Old);
  }

   
}

sonali verma
divya

 
Error occurred while trying to proxy request /api/sessions from localhost:3001 to http://localhost:3002 (ECONNREFUSED) (https://nodejs.org/api/errors.html#errors_common_system_errors)