• KONDA B 4
  • NEWBIE
  • 30 Points
  • Member since 2019

  • Chatter
    Feed
  • 1
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 4
    Questions
  • 6
    Replies
 <td> {!IF((item.Next_Item_Category__c == 'G2N')?'Credit':'Debit')}</td>

The above condition is throwing a Syntax error. Please help me 
I have done Trigger validation on some specific custom filed. But focus is not showing on Error  field ?   Please provide the soultion.
<aura:component >
    <aura:attribute name="item" type="Camping_Item__c" required="true"/>
    <p><ui:outputText value="{!v.item.Name}"/></p>
    <p><ui:outputCurrency value="{!v.item.Price__c}"/></p>
    <p><ui:outputNumber value="{!v.item.Quantity__c}"/></p>
    <p><ui:outputCheckbox value="{!v.item.Packed__c}"/></p>
</aura:component>
I am getting only 57% code coverage when running test on the standard complete milestone class.

User-added image

Is there a way to get 100% coverage on this.

Here is my test class for this.
 
@isTest ()
private class MilestoneTest {
static testMethod void TestCompleteMilestoneCase(){
    
    List<Account> acts = new List<Account>();
Account myAcc = new Account(Name='TestAct', phone='1001231234');
acts.add(myAcc);
Account busAcc = new Account(Name = 'TestForMS', phone='4567890999'); acts.add(busAcc);
insert acts;
    
Contact cont = new Contact(FirstName = 'Test', LastName = 'LastName', phone='4567890999',
 accountid = busAcc.id);
insert(cont);
Id contactId = cont.Id;
    
    Entitlement entl = new Entitlement(Name='TestEntitlement', AccountId=busAcc.Id);
insert entl;
String entlId;
if (entl != null)
entlId = entl.Id;

    
    List<Case> cases = new List<Case>{};
    if (entlId != null){
        Case c = new Case(Subject = 'Test Case with Entitlement ',
            EntitlementId = entlId, ContactId = contactId);
    cases.add(c);
}
if (cases.isEmpty()==false){
    insert cases;
    List<Id> caseIds = new List<Id>();
    for (Case cL : cases){
        caseIds.add(cL.Id);
  }
  milestoneUtils.completeMilestone(caseIds, 'First Response', System.now());
} }
static testMethod void testCompleteMilestoneViaCase(){
    
    List<Account> acts = new List<Account>();
	Account myAcc = new Account(Name='TestAct', phone='1001231234');
	acts.add(myAcc);
	Account busAcc = new Account(Name = 'TestForMS', phone='4567890999'); acts.add(busAcc);
	insert acts;
    
	Contact cont = new Contact(FirstName = 'Test', LastName = 'LastName', phone='4567890999',
 	accountid = busAcc.id);
	insert(cont);
	Id contactId = cont.Id;
    
  	Entitlement entl = new Entitlement(Name='TestEntitlement2', AccountId=busAcc.Id);
	insert entl;
	String entlId;
	if (entl != null)
	entlId = entl.Id;
    
    List<Case> cases = new List<Case>{};
    for(Integer i = 0; i < 1; i++){
        Case c = new Case(Subject = 'Test Case ' + i);
        cases.add(c);
        if (entlId != null){
            c = new Case(Subject = 'Test Case with Entitlement ' + i,
            EntitlementId = entlId);
            cases.add(c);
} }
    insert cases;
    
    List<CaseComment> ccs = new List<CaseComment>{};
    for(Case c : cases){
        CaseComment cc = new CaseComment(CommentBody='TestPublic',
                IsPublished=true, ParentId=c.Id);
        ccs.add(cc);
        cc = new CaseComment(CommentBody='TestPrivate',
                IsPublished=false, ParentId=c.Id);
        ccs.add(cc);
    }
    if (ccs.isEmpty()==false)
insert ccs;
    
    List<EmailMessage> emails = new List<EmailMessage>();
    for(Case c : cases){
        emails.add(new EmailMessage(parentId = c.id));
    }
    if(emails.isEmpty()==false)
        database.insert(emails);
for(Case c : cases){
Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage(); String[] toAddr = new String[] {'user@company.com'};
    mail.setToAddresses(toAddr);
        mail.setSaveAsActivity(false);
        mail.setTargetObjectId(c.ContactId);
        mail.setWhatId(c.Id);
        mail.setHtmlBody('TestHTMLBody');
        mail.setPlainTextBody('TestTextBody');
        Messaging.sendEmail(new Messaging.SingleEmailMessage[] { mail });
}
for(Case c : cases){
    c.Status = 'Closed';
}
update cases;
    List<Case> insertedCases = [SELECT Subject,
                   Description,
                   (SELECT IsPublished, CommentBody From CaseComments),
                   (SELECT TextBody, Subject, Incoming From EmailMessages)
                   FROM Case
                   WHERE Id IN :cases];
}
}

 

Hi,

 

 I have a visualforce page created with some fields and a button basically a command button. Now I want to navigate to another page on click of the button i.e x page has button, on click of which i want to load the browser with page y. How do i do that?

 

 

Thanks in Advance,

Ravindra