• Keshab
  • NEWBIE
  • 26 Points
  • Member since 2015
  • Tech Lead
  • ET Marlabs


  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 9
    Replies
Hi All,

I have a logic on one object that like when a new record is created the status should be set as "Current" and when the second record is created for the same object the status of the previous record should become "Previous" and current record should become "Current".
trigger UpdatePerformanceStatusTrigger on Performance__c (after insert)
{

 UpdatePerformanceStatusUtils.updatePerformanceStatus(Trigger.new);  
  
}


public class UpdatePerformanceStatusUtils
{

//Update existing Performance record Status On Creation Of a New Performance Record

    public static void updatePerformanceStatus(List<Performance__c> performanceList)
    {
      List<Performance__c> objPerformance1 = new List<Performance__c>();
      try
      {
         String vendorId = performanceList[0].Vendor__c; 
         String performanceId = performanceList[0].Id;          
         List<Performance__c> performanceRecords = [select Id , Performance_Status__c from Performance__c where id !=: performanceId and Performance_Status__c = 'Current Record' and Vendor__c =: vendorId];
         for(Performance__c performance1: performanceRecords)
         {
             performance1.Performance_Status__c = 'Previous Record';
             objPerformance1.add(performance1); 
         }
         update objPerformance1;
       }
       catch(DmlException e)
       {
           System.debug('The following exception has occurred: ' + e.getMessage()); 
       }          
    }
    
}

Each Vendor object has many Performance records.When i do this manually it works but when i do it in bulk it doesnt meaning all records have by default status as "Current".
Thanks for any help in advance.
Hey guys,

Need some help, I have a apex class with soql query on Reports of type (Task & Events) in the UAT, the reports for now returns 0 records as I have some filters as Date = Last 30 Days, I'm not able to cover the query line in test class as the report result 0 count, if the same report result atleat 1 record the query line are covered in the test class. Rest all the code lines are covered except these query lines.

Also a question, while moving the code from sandbox to production through change set will the test class validate against production org data or sandbox.

Thanks in advance,
Jancy Mary
Hi Team,

Can any one help us How To "Update All Opportunities where the Opportunity Close Date is in the Future"

Thanks in advance
 
  • June 06, 2016
  • Like
  • 0
Hi All ,

I am new to integration and have recuirement to make a callout to redhat!!
If anyone has on Salesforce --> Redhat Integration ...Brief info with 2 to 3 points on how to connect(mechanism) and the supported Api's, would be very helpful.

Thanks for the info,
Mahesh patel
I have Guys,i need datamigration information with videos 

from salesforce to salesforce and Microsoft Dynamic crm to salesforce

Anyone please help me
 
We have a requirement to create a REST Service that will send Data from a Custom object on click of a Button. how we can achive please help  me
I have the different methods in controller and it is fetching the user.name based  login details.
Controller is having the different methods and each method want to check the user.name details in where clause of soql.
Please let me know how to write a method and to hold the user.name details and use the same in all the methos where clause.
Hi, 
I wonder if there is in APEX a way to validate a JSON string against a defined json schema ?
Somthing like  :
If(isValid(jsonString, jsonSchema)) {
doCallout();
}
Basically, we are unable to make callouts to a third party system because they want us to validate our JSON payload with a schema before sending as part of their quality requirements.

Link to the schema  : 
https://realtime-listings.webservices.zpg.co.uk/docs/v1.0/schemas/listing/update.json