• Asiereiki
  • NEWBIE
  • 45 Points
  • Member since 2013

  • Chatter
    Feed
  • 1
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 30
    Replies

Hi,

Need to create a report which comprise of 3 objects.

2 objects are in Master detail relationship, while the other is having a lookup with one of those 2 .  

 

for eg.

Objects P and Q are in a master-detail relationship, while R is having a lookup with P.

Hey guys, I am attempting to test my extension. It is getting 90% coverage and yet it is still failing funnily enough (I thought anything over 75% was a pass). I know why it is failing, I am just not sure how to rectify it. 

Basically, I have a VF page which is for a survey object that I am creating. The goal is to automatically send out a URL after a client has completed certain milestones. The URL will be part of an email template that will send a link to the site.com hosted version of the VF page with the clients account ID in the URL.. The client will complete the survey and upon clicking save, the survey will be inserted into the clients object by the extension which will draw the account ID from the URL....It all works fine in sandbox, testing just fails as I do not know how to test for AccountID when it gets it from the URL. These are my three codes:

VF page:

<apex:page standardController="Destiny_Survey__c" extensions="extDestinySurvey" >

<apex:includeScript value="{!URLFOR($Resource.jQuery, '/js/jquery-1.9.1.js')}"/>
<apex:includeScript value="{!URLFOR($Resource.jQuery, '/js/jquery-ui-1.10.3.custom.min.js')}"/>
<apex:stylesheet value="{!URLFOR($Resource.jQuery, '/css/ui-lightness/jquery-ui-1.10.3.custom.css')}"/>

<apex:form id="theForm">
<apex:pageBlock id="theBlock">
<apex:pageBlockSection id="theSection1" title="Thank you for completing our Destiny Survey {!Destiny_Survey__c.Account__c}" />
<apex:pageBlockSection id="theSection" columns="1" >
<apex:inputField value="{!Destiny_Survey__c.Which_Product_or_Service__c}" label="Which Destiny Product or Service have you just completed?" id="value3"/>
    <div id="slider" style="length:50"/>
    <apex:inputField value="{!Destiny_Survey__c.How_likely_are_you_to_refer_Destiny__c}" label="How likely is it that you would recommend us to a friend or colleague?" id="value"/>
     <apex:inputField value="{!Destiny_Survey__c.Explain_why_you_gave_your_rating__c}" label="Explain why you gave your rating." id="value2"/> 
    
    
</apex:pageBlockSection>
</apex:pageBlock>

<apex:commandButton value="Save" action="{!saveDestinySurvey}"/>
</apex:form>


<script>
    function getCleanName(theName)
    {
        return '#' + theName.replace(/:/gi,"\\:");
    }
    var valueField = getCleanName( '{!$Component.theForm.theBlock.theSection.value}' );

    $j = jQuery.noConflict();
    $j( "#slider" ).slider( {enable: true, min: 0, max: 10, orientation: "horizontal", value: 0} );
    $j( "#slider" ).on( "slidechange",
        function( event, ui )
        {
            var value = $j( "#slider" ).slider( "option", "value" );
            $j( valueField ).val( value );
        }
    );
</script>

</apex:page>




This is my Extension:

public class extDestinySurvey
{
    public Destiny_Survey__c Dess {get;set;}

    private Id AccountId
    {
        get
        {
            if ( AccountId == null )
            {
                String acctParam = ApexPages.currentPage().getParameters().get( 'acct' );
                try
                {
                    if ( !String.isBlank( acctParam ) ) AccountId = Id.valueOf( acctParam );
                }
                catch ( Exception e ) {}
            }
            return AccountId;
        }
        private set;
    }

    public extDestinySurvey(ApexPages.StandardController controller)
    {
        Dess = (Destiny_Survey__c)controller.getRecord();
    }

    public PageReference saveDestinySurvey()
    {
        Dess.Account__c = AccountId;
        upsert Dess;

        // Send the user to the detail page for the new account.
        return new PageReference('/apex/DestinyAccount?id=' + AccountId + '&Sfdc.override=1');
    }
}



This is my Test that fails at 90%:

@isTest
private class TestExtDestinySurvey {

static testMethod void TestExtDestinySurvey(){
        //Testing Survey extension

// create a test account that will be use to reference the Destiny Survey Record




Account acc = new Account(Name = 'Test Account');
insert acc;

//Now lets create Fact Finder record that will be reference for the Standard Account
        Destiny_Survey__c DessTest = new Destiny_Survey__c(Account__c = acc.id, Explain_why_you_gave_your_rating__c = 'Because', How_likely_are_you_to_refer_Destiny__c = 8);
       
   
       
        //call the apepages stad controller
        Apexpages.Standardcontroller stdDess = new Apexpages.Standardcontroller(DessTest);

//now call the class and reference the standardcontroller in the class.
        extDestinySurvey ext = new extDestinySurvey(stdDess);
       
      
//call the pageReference in the class.
        ext.saveDestinySurvey();
    }
   
    }


hi i have three custom objects bills customers and products and what I am trying to do is that when we create a bill it should be populated on the customers related list.. And the bill should contain the related products on the .. there can be multiple products and it won't be possible to create a new product on every bill we should be able to select multiple products for a bill . how can we achieve this...

Hi,

 

Why cany be have a Evaluation criteria of only on 'Update of a record '?

How is this gonna impact ?

 

Please let me know.

 

Thanks,

Hi,

 

I have a Contact and Opportunity(Donations) objects.

Opportunity is child obj for Contact.

 

In our case,  for one contact there may be several opportunity( donation) records. 

 

Close date and Amount are two fields in opportunity.

 

How to query for a condition in sql, most recent close date and most recent amount ? for a given date range and given amount range.

 

select  name,max(date),amount

from donations

where closedate> '2011-3-4' and closedate < '2012-2-4' and amount>10 and amount<100

group by name

 

but it throws me an error on amount field as it is not in aggregate function.

 

how to modify this query such that for each contact record, it pulls donation's recent close date and recent amount. ( Consider for 1 contact we have 10 donations. so we need to pull 10th donation details.)

How to use not qual to operator in SOQL

 

In sql, fieldname !='%xyz%'

 

how about soql?

 

here am trying to check for the picklist values.

 

Thanks in advance

Hi,

 

  I made a email alter when work flow condition is set as mentioned below. 

 

  In Lead there is a Column called Lead Status  When lead status is changed to MQL or SQL it must trigger email to User. 

 

   I tried with Operator Contains(MQL, SQL) its not working,  But when i mention equal to MQL or SQL it is working. 

 

  Please suggest me how to add this condition. 

 

Thanks

Sudhir

HI,

 

i need to send email to case owner and case creator whenever case is closed. i wrote after update trigger for this. but its not working. can anyone help me out from this.

 

 

Thanks & Regards

Ram

Hi im newbiee

 

I have problem i write : 

 

trigger createReservation on Rezerwacja__c (before insert, before update) {

Set<id> rezSet = new Set<id>();

for (Rezerwacja__c rez : trigger.new){
rezSet.add(rez.Item__c);
}


List<Rezerwacja__c> rezList = [SELECT Rental_Date__c, Date_of_return__c, Status__c
FROM Rezerwacja__c
where id in :trigger.new];
List <Item__c> itList = [SELECT id, name FROM Item__c WHERE Item__c.Rezerwacja__c IN : rezList];

Map<Id, List<Rezerwacja__c>> rezMap = new Map<Id, List<Rezerwacja__c>>()

 

 

 

i wants the item was not available in a given period of time

Can somebody help me ?? 

  • March 20, 2013
  • Like
  • 1

Simply updating the event does not send out the invites. Is there a way via apex to send updates to attendees when an event is updated?

I have an apex component in which the constructor in the controller is exectuting twice. I have made all the pages and classes as simple as possible to reproduce and this is what we have:

 

The Page

<apex:page >	
    <c:myComponent />
</apex:page>

 

The Component

<apex:component controller="MyController" >
    <apex:form >
        <apex:actionFunction name="thisIsMyName" action="{!doSomething}"  />	
    </apex:form>
</apex:component>

 

The Controller

public class MyController {
	
    //Constructor
    public MyController(){
        system.debug('I am a constructor and I am executing multiple times to drive you crazy.');
    }
    
    public void doSomething(){
    	//Blah blah blah
    }

}

 

The Debug Log

23.0 APEX_CODE,DEBUG
18:56:46.028 (28871000)|EXECUTION_STARTED
18:56:46.028 (28903000)|CODE_UNIT_STARTED|[EXTERNAL]|066500000008tEE|VF: /apex/mypage
18:56:46.039 (39198000)|CODE_UNIT_STARTED|[EXTERNAL]|01p50000000DYoB|MyController <init>
18:56:46.039 (39850000)|METHOD_ENTRY|[1]|01p50000000DYoB|MyController.MyController()
18:56:46.039 (39939000)|METHOD_EXIT|[1]|MyController
18:56:46.041 (41245000)|USER_DEBUG|[5]|DEBUG|I am a constructor and I am executing multiple times to drive you crazy.
18:56:46.041 (41308000)|CODE_UNIT_FINISHED|MyController <init>
18:56:46.041 (41830000)|CODE_UNIT_STARTED|[EXTERNAL]|01p50000000DYoB|MyController <init>
18:56:46.041 (41872000)|USER_DEBUG|[5]|DEBUG|I am a constructor and I am executing multiple times to drive you crazy.
18:56:46.041 (41894000)|CODE_UNIT_FINISHED|MyController <init>
18:56:46.071 (71248000)|CODE_UNIT_FINISHED|VF: /apex/mypage
18:56:46.071 (71263000)|EXECUTION_FINISHED

Any ideas why this is happening. It is making me go a little crazy.

 

If I move everything that is in the component directly to the page it will only execute once, as expected, but I need use components.

 

Thanks,

Jason

  • April 29, 2012
  • Like
  • 1

Could I get simple example of how to loop through a multi-select picklist field?

 

Thanks!