• Amita Tatar 15
  • NEWBIE
  • 0 Points
  • Member since 2016

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 4
    Questions
  • 5
    Replies
Hi all,

I have two objects Booking and Invoice having Master Detail relationship.
i want to update a field on invoice which is a difference calculation. I have written a trigger but it is giving me some exceptions.
I wll post my code. Please help to fix the issue 
trigger updateAmount on Invoice__c (after update)
{
  Set<Id> bookings = new Set<Id>();  
  List<Invoice__c> invoiceToUpdate = new List<Invoice__c>();
            
    for(Invoice__c inv:Trigger.new)
    {    
      if (inv.Booking__c != null) 
      {
        bookings.add(inv.Booking__c);
        system.debug('----------***Bookings****-------:'+bookings);
      }  
    }
   
   Invoice__c invoiceCancel = [SELECT Id,Status__c,Grand_Total__c FROM Invoice__c WHERE Booking__c IN:bookings
                      AND Status__c='Cancelled' ORDER BY createdDate DESC LIMIT 1];
                      
      System.debug('---------------invoiceCancel -------------'+invoiceCancel );  
                      
      //Decimal grandAmt1 =    
      //System.debug('---------------grandAmt1-------------'+grandAmt1);            
                      
   Invoice__c invoiceNew = [SELECT Id,Status__c,Grand_Total__c,Amount_Difference__c FROM Invoice__c WHERE Booking__c IN:bookings AND Status__c='New']; 
   
       //Decimal grandAmt2 =   
       //System.debug('---------------grandAmt2 -------------'+grandAmt2 );                   
   
       for(Invoice__c inv:trigger.new)
       {
          Decimal GrtTotal = invoiceNew.Grand_Total__c - invoiceCancel.Grand_Total__c;
          inv.Amount_Difference__c =  GrtTotal;
          System.debug('---------------Amount_Difference__c-------------'+inv.Amount_Difference__c );
          Invoice__c invv = new Invoice__c();
          invoiceNew.Amount_Difference__c = inv.Amount_Difference__c;
       } 
        update invoiceNew;
        update invoiceToUpdate;                  
    
 }

 
Hi,

I want to display my reports and dashboards to my customer portal user.
How should i achieve this ? Please help.

Regards,
Amita Tatar
Hi,

I have my own students registration website from where they register for scholarships.
I have a requirement where i want to display the salesforce dashboard on my website homepage which will display number of scholarships availed VS remaining. How do i achieve this functionality ? Please help me on this.

Regards,
Amita Tatar
 
Hi all,

I have three record types with one page layout assigned to them.But the picklist values are different for all three record types.
When i log in as customer portal user,they are not able to see picklist values as defined for each record type.
I have created three profiles, three record types and assigned the picklist values as per the record type.
What can be the reason for picklist values not being visible to the portal user? Please help me. I need an urgent solution.

Thanks & Regards,
Amita Tatar
Hi all,

I have two objects Booking and Invoice having Master Detail relationship.
i want to update a field on invoice which is a difference calculation. I have written a trigger but it is giving me some exceptions.
I wll post my code. Please help to fix the issue 
trigger updateAmount on Invoice__c (after update)
{
  Set<Id> bookings = new Set<Id>();  
  List<Invoice__c> invoiceToUpdate = new List<Invoice__c>();
            
    for(Invoice__c inv:Trigger.new)
    {    
      if (inv.Booking__c != null) 
      {
        bookings.add(inv.Booking__c);
        system.debug('----------***Bookings****-------:'+bookings);
      }  
    }
   
   Invoice__c invoiceCancel = [SELECT Id,Status__c,Grand_Total__c FROM Invoice__c WHERE Booking__c IN:bookings
                      AND Status__c='Cancelled' ORDER BY createdDate DESC LIMIT 1];
                      
      System.debug('---------------invoiceCancel -------------'+invoiceCancel );  
                      
      //Decimal grandAmt1 =    
      //System.debug('---------------grandAmt1-------------'+grandAmt1);            
                      
   Invoice__c invoiceNew = [SELECT Id,Status__c,Grand_Total__c,Amount_Difference__c FROM Invoice__c WHERE Booking__c IN:bookings AND Status__c='New']; 
   
       //Decimal grandAmt2 =   
       //System.debug('---------------grandAmt2 -------------'+grandAmt2 );                   
   
       for(Invoice__c inv:trigger.new)
       {
          Decimal GrtTotal = invoiceNew.Grand_Total__c - invoiceCancel.Grand_Total__c;
          inv.Amount_Difference__c =  GrtTotal;
          System.debug('---------------Amount_Difference__c-------------'+inv.Amount_Difference__c );
          Invoice__c invv = new Invoice__c();
          invoiceNew.Amount_Difference__c = inv.Amount_Difference__c;
       } 
        update invoiceNew;
        update invoiceToUpdate;                  
    
 }

 
Hi,

I have my own students registration website from where they register for scholarships.
I have a requirement where i want to display the salesforce dashboard on my website homepage which will display number of scholarships availed VS remaining. How do i achieve this functionality ? Please help me on this.

Regards,
Amita Tatar
 
Hi all,

I have three record types with one page layout assigned to them.But the picklist values are different for all three record types.
When i log in as customer portal user,they are not able to see picklist values as defined for each record type.
I have created three profiles, three record types and assigned the picklist values as per the record type.
What can be the reason for picklist values not being visible to the portal user? Please help me. I need an urgent solution.

Thanks & Regards,
Amita Tatar