• amilaw
  • NEWBIE
  • 115 Points
  • Member since 2013

  • Chatter
    Feed
  • 4
    Best Answers
  • 1
    Likes Received
  • 0
    Likes Given
  • 10
    Questions
  • 34
    Replies

Hi All,

 

We need to do some modifications for the financial force app.

For example changing the pages for adding sales invoices. 

changing the existing page is not possible as it is a managed package. tried to created a new page with existing visualforce markups. but extensions are not visible.

are there any approaches other than developing page from the scratch ?

 

Thanks

Hi All,

 

I have no way to find what line are covered and what lines are not in a set of apex classes as they are not shown in the developer console test coverage class list.

Even after running all test classes.

Hi All,

 

Where can we get the couloured code coverage page for a class. link is not there any more. its in the developer console. but it doesnt work properly for large classes

 

Thanks

His all,

 

Is there a way to avoid sharing records fro users who dont have access to the object.

 

in soql even we used with sharing keyword, records are retrieved for the users who have sharing records but not read access in profile

Hi can any one help me out to get test coverage for .addError and .add statments

Below is the trigger and test calss.

Bold line are not covered with the existing test class.

trigger Erroriftwoopportunityareopen on Opportunity (before insert) {

 

    Set <id> setAccWithProspectingOpp = new Set <Id>();//Varaible to hold Account with Prospecting opp

    Set <id> setAccId = new Set <Id>();//Varaible to hold Account IDs

   

    if(trigger.isbefore){

        if(trigger.isinsert){

            //Iterate through opportunity

            for(Opportunity o:Trigger.new){

                //System.debug('Account Id -->'+o.Accountid);

                //Verify account id not null and opportunity stagename is Prospecting

                if(o.Accountid != Null && o.StageName == 'Prospecting'){

                    setAccId.add(o.Accountid);//Account is added to setAccId(Varaible)

                }

            }

            //System.debug('Set of accounts -->'+setAccId);

            //Fetch the accounitid of opportunity from aetAccId(Varaible)

            for(Opportunity Opp : [Select id,accountid from opportunity where accountid in :setAccId]){

                setAccWithProspectingOpp.add(Opp.accountid);//Add opportunity account id in setAccWithProspectingOpp(Variable)

            }

            //System.debug('Set of accounts with Prosp Opp-->'+setAccWithProspectingOpp);

            //Iterate through opportunity object

            for(Opportunity o:Trigger.new){

                //Chack condition that in setAccWithProspectingOpp(Varaible)contains opportunity account id

                if(setAccWithProspectingOpp.contains(o.accountid))

                    o.addError('This account already has Opportunity with StageName as Prospecting');  

            }

           

        }

    }

}

Test class

@isTest

    public class ErroriftwoopportunityareopenTest{

        static testMethod void Test(){

        User thisUser = [ Select Id from User where Id = :UserInfo.getUserId() ];

        Account acc = new Account(Name = 'TestAccount',Rating = 'Hot',Type = 'Prospect');

            //update acc;

        Opportunity opp = new Opportunity(Name = 'TestOpp',Accountid = acc.Id,CloseDate = Date.Today(),StageName = 'Prospecting');

            //update opp;

        Opportunity opp1 = new Opportunity(Name = 'TestOpp1',Accountid = acc.Id,CloseDate = Date.Today(),StageName = 'ClosedWon');

            //update opp1;

        Opportunity opp2 = new Opportunity(Name = 'TestOpp2',Accountid = acc.Id,CloseDate = Date.Today(),StageName = 'ClosedLost');

            //update opp2;

        Task t = new Task(WhatId=acc.Id,WhoId = opp.Id,Subject = 'Email',Status = 'Completed', Priority ='Normal');

            insert t;

        Test.startTest();

            insert acc;

            insert opp;

            insert opp1;

            insert opp2;

             User someOtherUser = [Select Id From User Where Id != :UserInfo.getUserId() And isActive = TRUE LIMIT 1];

    system.runAs(someOtherUser){

          insert opp;

     }

        Test.StopTest();

        }

    }

how to use css file 

Hello every body, I don't know why can't display the results in my visualforce page. The page don't show error only is empty

Please help me, I try to display the contacts in a family with their benefits

 

This is my visualforce page

 

<apex:page StandardController="Sayana__c" extensions="familiaExtension">
  <apex:pageBlock title="Beneficios">
  <apex:pageBlockTable value="{!BeneficiosTodos}" var="beneficio" cellPadding="3" border="1" columnsWidth="50px,110px,60px,60px,230px" rules="all">
     <apex:column value="{!beneficio.Contacto__c}"/>
     <apex:column value="{!beneficio.fecha_entrega__c}"/>
  </apex:pageBlockTable>
</apex:pageBlock>
</apex:page>

 

and this is the apex class

 

public class familiaExtension {

    private final Sayana__c sayana;
    private string idSayana;
    private final Contact contacto;    
    private final Beneficio__c[] beneficios;

    public familiaExtension(ApexPages.StandardController sayanaController) {
       this.sayana = (Sayana__c)sayanaController.getRecord();
       idSayana = sayana.id;
    }

    public List<Beneficio__c> getBeneficiosTodos()
    {
       for(Contact contact : [SELECT  id, Name from Contact where Sayana__c = :idSayana]){
           Beneficio__c[] beneficios  = contact.Beneficios__r;
       }       
       return beneficios;
    }
}

 

 

Hi

 

Ihave list which i want to show in two columns only.

Suppose My list have 1,2,3,4,5,6

 repeater display like this

1                                

2                                 

3        

4

5

6

 

I want layout like ..

 

1            2

3            4

5            6

 

Thanks & Regards

Ishan Sharma

Hi All,

 

I need to get the content of Rich Text Area Field without HTML markup when i query the field. Is there any method to get the text data excluding the markup?

 

Thank you in Advance,

 

Best Regards,

NHK