• Aleksei Kosov
  • NEWBIE
  • 45 Points
  • Member since 2018

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

I have a trigger that uses system.today() in multiple if statements. 

I am having difficuly trying to cover this in my test class. One of the statements checks if the current month is either July or August. As im currently testing this in January, it will not be covered.

What is the best way to dynamically cover this scenario?

Thanks,

Trigger (Currnent month is Janurary)
if(System.today().Month() == 7 || System.today().Month() == 8){

}


 
Hi,

I have a trigger that uses system.today() in multiple if statements. 

I am having difficuly trying to cover this in my test class. One of the statements checks if the current month is either July or August. As im currently testing this in January, it will not be covered.

What is the best way to dynamically cover this scenario?

Thanks,

Trigger (Currnent month is Janurary)
if(System.today().Month() == 7 || System.today().Month() == 8){

}


 
Hi,

I'm calling a existing component using create component and trying to pass attribute for it.
oneController.js
var id='25978371';
        $A.createComponent(
            "c:InDetails",
            {
                oppId: id,
            },
            function(newCmp){
                    component.set("v.currentContent", newCmp);
            }
        );
InDetails.cmp
<aura:attribute name="oppId" type="String"/>
InDetailsController.js
console.log(component.get("v.oppId"))

Indeatails components gets created in component one but console.log of oppId gives me undefined. I couldn't pass the attribute from one component to another.  
 
Hi,

Good day!
I have two custom objects, Project__c and Milestone__c,
Here, Milestone__c is having Lookup to Project__c. [Every project will have several milestone]
Project_c has two date fields(start_date__c , end_date__c)
Milestone__c has two date fields(start_date__c , end_date__c)

So, When i create a milestone, I select the project__c to which this milestone is going to be part of. And this milestone's duration should be within the start_date__c and end_date__c of the project__c it is belonging to. 

Is there any way to restrict the values displayed in start_date__c and end_date__c fields of the milestone__c, to be within the duration of project it is belonging to.


Thanks in advance,
Durairaj Saravanan.
Two users are having same profile and same role. If we want to restrict the record usage to one of the users, how can we achieve it?
Is it possible to query the year of a Holiday Record?

I created an Easter 2019 Holiday with the date of 4-21-2019

I tried the following:
Integer thisYear = date.today().year();
List<Holiday>Easter = [Select Id, ActivityDate,Name from Holiday where Name like '%Easter%' and Calendar_YEAR(ActivityDate) =:thisYear];


Received this error message: 
like '%Easter%' and Calendar_YEAR(ActivityDate) =:thisYear
                                  ^
ERROR at Row:1:Column:88
field ActivityDate does not support date function CALENDAR_YEAR


Any ideas anyone?
I am trying to update checkbox at Quote when price field at quote line items are not null. But the actual challenge is that the for loop checks only the last record not the entire scope. I mean the iteration of records not happening. Can someone pls give me some insight on this.
global class update_Quote_Chekbox implements Database.Batchable<sObject>,Database.Stateful
{
 global List<Id> QuotelineId  = new List<Id>();
   global update_Quote_Chekbox(List<Id> qlid)
   {
       QuotelineId  = qlid; //get the quote Id from the Quote LIne Item via trigger after record
                   system.debug('The qlid inside batch is'+qlid);

   }

   global Database.QueryLocator start(Database.BatchableContext BC)
   {

      string query= 'select SBQQ__Quote__c,SBQQ__ListPrice__c,SBQQ__Quote__r.Oracle_Pricing_Complete__c from SBQQ__QuoteLine__c where SBQQ__Quote__c in :QuotelineId';
      
      return Database.getQueryLocator(query);
      
   }

   global void execute(Database.BatchableContext BC, List<sObject> scope)
   {
                     
      for(Sobject s : scope)
      {
      
            
            SBQQ__QuoteLine__c lstAct = (SBQQ__QuoteLine__c)s;
                        system.debug('The scope is'+lstAct );

        
            if(lstAct.SBQQ__ListPrice__c!=NUll)
      {
         
            lstAct.SBQQ__Quote__r.Oracle_Pricing_Complete__c=true;
           // system.debug('The query is'+acr.Oracle_Pricing_Complete__c);
            update lstAct.SBQQ__Quote__r;
            }
            else{
            lstAct.SBQQ__Quote__r.Oracle_Pricing_Complete__c=false;
             update lstAct.SBQQ__Quote__r;
            }
            
      }   
      
   }
      
   


   global void finish(Database.BatchableContext BC)
   {
   }

}