• zorans
  • NEWBIE
  • 35 Points
  • Member since 2013

  • Chatter
    Feed
  • 1
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 2
    Questions
  • 6
    Replies
If I run below query in query editor it runs fine and give all fields but in Apex or execute anomynous it gives just CaseNumber, ContactId, ID.

List<sObject> lst = [SELECT CaseNumber, Contact.FirstName, Contact.LastName, Contact.Email, ContactId, Id FROM Case  WHERE ID IN('500o0000001OaQsAAK','500o0000001OaR0AAK','500o0000001OaQeAAK') and Contact.Email <> null order by CaseNumber limit 10000];
System.debug(lst);

Any help would be appreciated
 
Hi All,

I have a simple question about about opoortunities in account subquery. I am trying to fetch particular opportunities(based on StageName) in account subquery but the problem is that subquery is not returning All opportunities connected with particular account even without a WHERE condition.

I have:
 
SELECT ID,Name,Sales_Funnel__c,(Select Name,StageName,createdDate, id FROM Opportunities__r ShowAll order by CreatedDate desc) FROM Account WHERE id='j52gcw632x4bj43'
It is just returning 4 opportunities out of 9. I even tried with ShowAll in the query but it does not make any difference.

If I make a query for the particular opporutnity that subquery is not returning inside subquery it is normally returned and also with accounid and name etc.
 
Select CreatedDate, name, StageName, Account_Manager__c, Account.Name,accountid From Opportunity where id='g2dhjk50fjkB14g'

This particular opportunity (among other 5 that are missing) is also normally visible @ Account page layout also.

Knowing that these are standard objects I was wondering if there are any restrictions that are applied for these case scenarios.
Please Help :)

Thanks in advance.
  • November 10, 2014
  • Like
  • 0

Hi all,

 

I was learning new things from an apex_workbook and on exception chapter when I tried to create custom exception I was using two classes in one file(book example)

 

Because I am new in all this, I couldn't determine how to handle an error in this (Save error: unexpected token: public) code

 

Error occures in 3. row: it underlines reserved word 'public' ...

 

public class MerchandiseException extends Exception{}

public class MerchandiseUtility{
	
	public static void mainProcessing(){
		try{
			insertMerchandise();
		}catch(MerchandiseException me) {
			System.debug('Message: ' + me.getMessage());
			System.debug('Cause: ' + me.getCause());
			System.debug('Line number: ' + me.getLinenumber());
			System.debug('Stack trace : ' = me.getStackTraceString());
		}
	}
	
	public static void InsertMerchandise(){
		try{
			Merchandise__c m = new Merchandise__c();
			insert m;
		}catch(DMLException e){
			throw new MerchandiseException('Merchandise item could not be inserted ' + e)
		}
	}
	
}

 

Thanks in advance.

  • November 16, 2013
  • Like
  • 0
Hello,

I'm working on a visualforce page. At the moment, it only has 2 colomns with the name of the field and the values displayed. (In my screenshot, it's the lines  with 24 mois, 36 mois or 48 mois.)

However, I would need to add a third column, with the name of the field and also its values. What I've done is adding a "page blocksection columns = 3" but this makes the result very bad looking, with bad gaps between fields. I would like those fields to be with a normal gap, I don't know how I can do.

Here is the screenshot : User-added image

And here is the code (I've only gone until the 24mois line as it's the same for 36 and 48)
<apex:pageblocksection columns="1" title="{!$Label.PRICER_Parametres_offres}" collapsible="true" showHeader="true">
            <apex:pageblocksection columns="2">
                <apex:pageblocksectionitem >
                    <apex:outputlabel for="IdDateDebutContrat" value="{!$ObjectType.Offre__c.Fields.DateDedebut__c.label}"/>
                    <apex:selectList id="IdDateDebutContrat" value="{!oOfferOptionDM.sDateDebutContrat}" size="1">
                        <apex:selectOptions value="{!oOfferOptionDM.lDateDebutContrat}"/>
                    </apex:selectList>
                </apex:pageblocksectionitem>
                <apex:pageblocksectionitem >
                    <apex:outputlabel for="IdDateValidite" value="{!$ObjectType.Ref_Config_Pricer__c.Fields.Date_validite_offre__c.label}"/>
                    <apex:outputText id="IdDateValidite" value="{!oOfferOptionDM.sDateValiditeOffre}"/>
                </apex:pageblocksectionitem>
                <apex:pageblocksectionitem >
                    <apex:pageblocksection columns="3" >
                    <apex:pageblocksectionitem >    
                        <apex:outputlabel for="Id12Mois" value="{!$ObjectType.Offre__c.Fields.X12_mois__c.label}" />            
                        <apex:inputField id="Id12Mois" value="{!oOfferOptionDM.oOffer.X12_mois__c}"/>
                    </apex:pageblocksectionitem>
                    <apex:pageblocksectionitem >
                        <apex:outputlabel for="IdMarge12Mois" value="{!$ObjectType.Offre__c.Fields.TECH_Marge_12_mois_EMWh__c.label}" styleClass="labelCol"/>
                        <apex:inputField id="IdMarge12Mois" value="{!oOfferOptionDM.oOffer.TECH_Marge_12_mois_EMWh__c}"/>
                    </apex:pageblocksectionitem>
                    <apex:pageblocksectionitem >
                        <apex:outputlabel for="IdMarge12Mois" value="{!$ObjectType.Offre__c.Fields.TECH_BC_12_mois_EMWh__c.label}" styleClass="labelCol"/>
                        <apex:inputField id="IdMarge12Mois" value="{!oOfferOptionDM.oOffer.TECH_BC_12_mois_EMWh__c}"/>
                    </apex:pageblocksectionitem>
                    </apex:pageblocksection>
                </apex:pageblocksectionitem>

<apex:pageblocksectionitem >    
                        <apex:outputlabel for="Id24Mois" value="{!$ObjectType.Offre__c.Fields.X24_mois__c.label}"/>         
                        <apex:inputField id="Id24Mois" value="{!oOfferOptionDM.oOffer.X24_mois__c}"/>
                    </apex:pageblocksectionitem>
                    <apex:pageblocksectionitem >
                        <apex:outputlabel for="IdMarge24Mois" value="{!$ObjectType.Offre__c.Fields.TECH_Marge_24_mois_EMWh__c.label}" styleClass="labelCol"/>                   
                        <apex:inputField id="IdMarge24Mois" value="{!oOfferOptionDM.oOffer.TECH_Marge_24_mois_EMWh__c}"/>
                    </apex:pageblocksectionitem>
                </apex:pageblocksectionitem>

Thanks for your help
 
If I run below query in query editor it runs fine and give all fields but in Apex or execute anomynous it gives just CaseNumber, ContactId, ID.

List<sObject> lst = [SELECT CaseNumber, Contact.FirstName, Contact.LastName, Contact.Email, ContactId, Id FROM Case  WHERE ID IN('500o0000001OaQsAAK','500o0000001OaR0AAK','500o0000001OaQeAAK') and Contact.Email <> null order by CaseNumber limit 10000];
System.debug(lst);

Any help would be appreciated
 
Hi All,

I have a simple question about about opoortunities in account subquery. I am trying to fetch particular opportunities(based on StageName) in account subquery but the problem is that subquery is not returning All opportunities connected with particular account even without a WHERE condition.

I have:
 
SELECT ID,Name,Sales_Funnel__c,(Select Name,StageName,createdDate, id FROM Opportunities__r ShowAll order by CreatedDate desc) FROM Account WHERE id='j52gcw632x4bj43'
It is just returning 4 opportunities out of 9. I even tried with ShowAll in the query but it does not make any difference.

If I make a query for the particular opporutnity that subquery is not returning inside subquery it is normally returned and also with accounid and name etc.
 
Select CreatedDate, name, StageName, Account_Manager__c, Account.Name,accountid From Opportunity where id='g2dhjk50fjkB14g'

This particular opportunity (among other 5 that are missing) is also normally visible @ Account page layout also.

Knowing that these are standard objects I was wondering if there are any restrictions that are applied for these case scenarios.
Please Help :)

Thanks in advance.
  • November 10, 2014
  • Like
  • 0

Hi all,

 

I was learning new things from an apex_workbook and on exception chapter when I tried to create custom exception I was using two classes in one file(book example)

 

Because I am new in all this, I couldn't determine how to handle an error in this (Save error: unexpected token: public) code

 

Error occures in 3. row: it underlines reserved word 'public' ...

 

public class MerchandiseException extends Exception{}

public class MerchandiseUtility{
	
	public static void mainProcessing(){
		try{
			insertMerchandise();
		}catch(MerchandiseException me) {
			System.debug('Message: ' + me.getMessage());
			System.debug('Cause: ' + me.getCause());
			System.debug('Line number: ' + me.getLinenumber());
			System.debug('Stack trace : ' = me.getStackTraceString());
		}
	}
	
	public static void InsertMerchandise(){
		try{
			Merchandise__c m = new Merchandise__c();
			insert m;
		}catch(DMLException e){
			throw new MerchandiseException('Merchandise item could not be inserted ' + e)
		}
	}
	
}

 

Thanks in advance.

  • November 16, 2013
  • Like
  • 0

Hi,

 

I have a date input field in a popup window. Issue that i am facing is the date picker is not inligned with the text field. Could any one please address this issue

 

Thanks and Regards,

Neha

I have an unusual problem. I  have developed an Apex class which implments schedulable.  I go into Setup -> Develop -> Apex Classes -> Schedule Apex and fill in the form. Now, when I'm selecting the class I just press the icon to give me a list and it only returns the one class which implements schedulable, which would appear the smart way of letting you select the class.

 

However, I get the following error -

Error: You must select an Apex class that implements the Schedulable interface.

 

I'm really baffled by this, see code below.

 

global class TimesheetWeeklyJob implements Schedulable{
    global void execute( SchedulableContext SC ) {
        WeeklyTimesheetProcess.markSubmitted();
        WeeklyTimesheetProcess.createNewSheets();
    }
}