• Narayanan Natarajan
  • NEWBIE
  • 30 Points
  • Member since 2016
  • Selfless Service(Developer)

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

I am unable write code cover for the below else condition because of Test.isRunningTest(), In every time if condition is executed, but else is not executing. help me on this. 

if ((Name__c != null && Cheque_Number__c != null && Branch__c != null ) || Test.isRunningTest()) {
errMsg = 'Name existing in database';
} else {
errMsg='';
}

Thanks in Advance

Regards,
raju
I am New to Salesforce,I don't Know How to Complete Below Trigger Scenario...PLZ help me to Complete below scenario...i will be highly oweful to you..


My Trigger Scenario:I have a object called "Project" having below Fields.
       ---->Project Name
       ---->Project Start Date
       ---->Project End Date
       ---->Total NO.of Hours( default value 100 hours )
       ---->Project Ratio(Picklist Data Type) having below values(Interms of Hours)
                --> 100-1
                --> 70-30    
                --> 50-50
                --> 30-70
                --> 0-100
Requirement:
------------
   If user selects Project Start Date And Project End Date,For Example User Select 2-3-2017 as Project Start Date and 20-9-2017 as Project End Date  and
       -->if user select "100-1" from picklist,total 100 hours(before Hyphen value) should be alloted to Project Start Date i.e "March" in this case.
       -->if user select "70-30" from picklist, 70 hours(before Hyphen value) should be alloted to Project Start Date i.e "March" in this case, remaining 30 Hours(after Hyphen Value) should be alloted to remaining months(In my case April,may,june,july,August,sep),we have to consider number of days in each month as well.
       -->if user select "50-50" from picklist, 50 hours(before Hyphen value) should be alloted to Project Start Date i.e "March" in this case, remaining 50 Hours(after Hyphen Value) should be alloted to remaining months(In my case April,may,june,july,August,sep),we have to consider number of days in each month as well.
       -->if user select "30-70" from picklist, 30 hours(before Hyphen value) should be alloted to Project Start Date i.e "March" in this case, remaining 70 Hours(after Hyphen Value) should be alloted to remaining months(In my case April,may,june,july,August,sep),we have to consider number of days in each month as well.
       -->if user select "0-100" from picklist,total 100 hours(After Hyphen value) should be alloted to Project End Date i.e "March" in this case.
After Completion of Above Requirement every Project Record should have a related list with below records:
       -->In Case Of "100-1" pick list Selection
           Record 1:March-100
           Record 2:April-0
           Record 3:May-0
           Record 4:June-0
           Record 5:July-0
           Record 6:AUgust-0
           Record 7:September-0

       -->In Case Of "30-70" pick list Selection
           Record 1:March-30
           For Remaining six records,70 hours should be devided to remaining Months ,we have to consider number of days in each month as well.
 
--------->Continue the above process for Remaing Pick List Selecton values As well.
please help me on this.........