• hoomel
  • NEWBIE
  • 175 Points
  • Member since 2010

  • Chatter
    Feed
  • 7
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 27
    Questions
  • 37
    Replies

Hello,

 

I have run into a problem with using IF conditions in apex:repeat.

 

I have various translated description fields that are referenced in the apex:repeat. If the field for the specific language (Japanese) is empty, the standard english language needs to be used.

This is my code:

<apex:repeat value="{!Quotelist2}" var="l2">
	<tr style="font-size:80%;font-family:Arial Unicode MS;">
		<td valign="top">{!IF(10 > cnt,"0","")}{!FLOOR(cnt)}</td>
		<td valign="top">{!l2.Item__r.Item_name__c}</td>
		<td valign="top">{!IF(l2.Item__r.Short_description_japanese__c = "",l2.Item__r.Short_description_english__c,l2.Item__r.Short_description_japanese__c)}</td>
	</tr>
<apex:variable var="cnt" value="{!cnt+1}" />
</apex:repeat>

 When saving it like this in Force.com IDE, I get "Save error: Unknown property: pdfData.l2"

 

pdfData is the name of the controller, but l2 should simply be the variable the apex:repeat provides, doesn't it?

 

What am I overlooking here?

 

Thanks in advance and Best Regards,

hoomel

  • August 07, 2013
  • Like
  • 0

Hi,

 

I created a trigger on the User object, to fill a field with the date on which the user was activated, respectively deactivated.

 

When a new user is created, the current date should also be put in a field. This especially causes a LICENSE_LIMIT_EXCEEDED.

Why exactly is this caused and how can I avoid it?

 

Here's the code:

trigger userTrigger on User (before update, before insert) {
	private User[] newUser = Trigger.new;
	private User[] oldUser;
	if(Trigger.isUpdate){oldUser = Trigger.old;
		if(oldUser[0].isActive == false && newUser[0].isActive == true){
			newUser[0].Last_Inactive__c = System.now();
		}
		if(oldUser[0].isActive == true && newUser[0].isActive == false){
			newUser[0].Last_Active__c = System.now();
		}
	}
	if(Trigger.isInsert){newUser[0].Last_Inactive__c = System.now();}
}

 Thanks for the help in advance,

 

Regards,

hoomel

  • March 21, 2013
  • Like
  • 0

Hello,

 

as I am aware, Triggers on the User object are a bit 'hinky' but a customer had a requirement for a trigger.

 

This is the Trigger I wrote:

trigger userTrigger on User (before insert, before update) {
	private User[] newUser = Trigger.new;
	private User[] oldUser = Trigger.old;
	
	if(oldUser[0].isActive == false && newUser[0].isActive == true){
		newUser[0].Last_Inactive__c = System.now();
	}
	if(oldUser[0].isActive == true && newUser[0].isActive == false){
		newUser[0].Last_Active__c = System.now();
	}
}


System.DmlException: Insert failed. First exception on row 0; first error: CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY, userTrigger: execution of BeforeInsert caused by: System.NullPointerException: Attempt to de-reference a null object

Trigger.userTrigger: line 5, column 1: []    Plasma_Production        line 1    Force.com run test failure

What can I do about it? I am currently out of ideas how to get around this error.

 

Thanks in advance,

hoomel

  • February 21, 2013
  • Like
  • 0

Hello,

 

I am having some trouble with chinese characters in PDF generation.

I do not know any chinese, but the customer gave me a document to copy the text excerpts from and I have already done that. What strikes me as odd is that most of the characters show up, but some just don't.

Wherever I want to insert them in the page, they are not shown in the PDF.

 

Is there any reason why this is happening?

This is one of the text excerpts that do not show up anywhere on the page: 设备租用报价

 

Maybe I have to set some enconding parameters in the header?

 

Thanks for any advice.

 

Best Regards,

Marc

  • February 21, 2012
  • Like
  • 0

Hello,

 

i am having some questions about Modal Dialogs in Visualforce.

 

I followed the tutorial here and built a modal dialog with an apex:inputFile.

The background of that is:

I am putting together a mail form with extended functionality. The user should be able to upload one ( or more ) files and actually see which files he has uploaded.

The current problem is, that clicking any button on the modal dialog refreshes the whole page, which deletes all previously entered values.

Now, I would like to disable this as a user would first enter the recipient information of the email and select attachments later. Selecting an attachment should not delete the recipient information.

 

Is this in any way possible to do? Rerendering a list of uploaded files is mainly the problem for me.

 

Regards,

hoomel

  • August 17, 2011
  • Like
  • 0

Hello,

 

I would enable the our users to select any document from a folder an attach it to an email.

I already have the functionality to select existing attachments and to upload a file, but I do not seem to get the correct list of document folders.

 

What I would like to do is:

A drop-down selectList to select the documents' folder.

Then a selectList to show the documents in the selected folder and let the user select the documents he wants to attach to the emailMessage.

 

Currently this is where I am stuck. The list of folders always contains every users' personal folder. I would rather use the same list that is displayed when accessing the Document object.

Is there any way to mimic the behavior of that picklist?

 

Regards,

hoomel

  • August 11, 2011
  • Like
  • 0

Hello,

 

I am currently having some trouble with a very unspecific error message.

An internal server error has occurred
An error has occurred while processing your request. The salesforce.com support team has been notified of the problem. If you believe you have additional information that may be of help in reproducing or correcting the error, please contact Salesforce Support. Please indicate the URL of the page you were requesting, any error id shown on this page as well as any other related information. We apologize for the inconvenience.

Thank you again for your patience and assistance. And thanks for using salesforce.com!

Error ID: 1532630577-98471 (-2023769877) 

 

It happens as soon as I remove the {get;set;} from a List<String> and write the getter-methods separately.

 

This is what causes the error:

public List<String> toList;
public List<String> ccList;
public List<String> getToList(){
		return toList;
	}
public List<String> getCCList(){
		return ccList;
	}

  And this is how the error disappears:

	public List<String> toList{get;set;}
	public List<String> ccList{get;set;}

 

As the error message does not give any information at all, is it possible to find out more about what is causing the error?

Or is there something wrong how I wrote the getter-method? I do not expect that to be the problem, because I did that a couple of times before, but maybe there is something wrong?

 

Maybe there is a possibility to search for that Error ID to get some more information? I could not find anything in that direction.

 

This currently stops my progress, so any hint at all would be great!

 

Regards,

hoomel

  • August 09, 2011
  • Like
  • 0

Hello,

 

i have fairly general question, but i cannot seem to find any information on this matter:

 

What exactly is the difference between SingleEmailMessage and MassEmailMessage?

 

This is what i know:

  • They both count against different organisation limits

From the Apex Code Documentation I concluded that I can add multiple targetObjectIds for a MassEmail and only one for a single email. Is that correct?

So a MassEmail could be logged as an activity for multiple contacts and a SingleEmail could be logged only for one contact?

 

Maybe someone can confirm this or clear out the differences to me?

 

Regards,

hoomel

  • August 04, 2011
  • Like
  • 0

Hello,

 

i am currently trying to create a Visualforce page which extends the "Send an Email"-functionality.

What I would like to do is create a lookup field for an account and then automatically populate a selectList with the related contacts to that account.

 

Is this in any way possible? The most challenging thing is assigning the selected account to a variable to query the list of contacts from it. Everything else should be fairly basic stuff.

 

Maybe someone has a hint for me.

 

Regards,

hoomel

  • August 02, 2011
  • Like
  • 0

Hello,

 

i wrote pretty basic data collecting class in Apex for generating a PDF document.

This is the class:

 

public with sharing class pdfData {
	public String sys = Apexpages.currentPage().getParameters().get('sys');
	public String userID = UserInfo.getUserId();
	public Integer lineCount = 0;
	public Integer maxLines = 21;
	public List<ItemSystemRelation__c> list1 = new List<ItemSystemRelation__c>();
	public List<ItemSystemRelation__c> list2 = new List<ItemSystemRelation__c>();
	public User curUser = [Select Street, PostalCode, City FROM User WHERE Id = :userID];
	public Rental__c rental = [Select Id, Name,Period__c, Owner.Name, Rental_fee__c, Calculation_starts_week__c, Start__c, End__c, Account_ERP_No__c,Account_Tax_number__c, Account_City__c, Account_Street__c, Account_Zip_Code__c, Account__r.Name FROM Rental__c WHERE Rental_System__c = :sys limit 1];
	public Rental_Systems__c rsystem = [Select Id, Name, System_Name__c FROM Rental_Systems__c WHERE Id = :sys limit 1];
	private List<ItemSystemRelation__c> items = [Select Item__r.Short_description__c, Item__r.Name, Item__r.Item_Name__c FROM ItemSystemRelation__c WHERE Rental_System__c = :sys AND Item__r.Active__c = true order by Item__r.Name];
	public String curDate = system.today().format();
	public pdfData(){
	}
	public Rental__c getRental(){
		return rental;
	}
	public Rental_Systems__c getRSystem(){
		return rsystem;
	}
	public String getToday(){
		return System.today().format();
	}
	public String getStart(){
		return rental.Start__c.format();
	}
	public String getEnd(){
		return rental.End__c.format();
	}
	public User getUser(){
		return curUser;
	}
	public Integer getItemCount(){
		return items.size();
	}
	public List<ItemSystemRelation__c> getItems(){
		return items;
	}
	public String getCurDate(){
		return curDate;
	}
	public void populateLists(){
		Integer totalLines = 0;
		for(Integer i = 0;i < items.size();i++){
			if(items.get(i).Item__r.Short_description__c != null){
				totalLines = math.round(totalLines + items.get(i).Item__r.Short_description__c.length()/80);
			}else{
				totalLines++;
			}
			if(totalLines < maxLines){
				System.debug(items.get(i));
				list1.add(items.get(i));
			}else{
				list2.add(items.get(i));
			}
		}
	}
	public List<ItemSystemRelation__c> getList1(){
		populateLists();
		return list1;
	}
	public Integer getSize1(){
		return list1.size();
	}
	public List<ItemSystemRelation__c> getList2(){
		return list2;
	}
	public Boolean getShowList2(){
		if(list2.size() < 1){return false;}else{return true;}
	}

 

 

I am now writing the test methods to deploy it in production, but it fails at the database query where the URL parameter is used.

How can I set this variable when creating a new instance of the class in the beginning of my test method?

Or is there any way around this problem?

 

Regards,

hoomel

 

  • February 15, 2011
  • Like
  • 0

Hello,

 

i built a Visualforce page where the user can input search criteria. It looks like this:

 

<apex:page controller="calCon">
<apex:sectionHeader title="Search assistant" subtitle="Step 1 of 2"/>
	<apex:form >
		<apex:pageBlock title="Enter search criteria here" mode="detail">
			<apex:pageBlockButtons location="bottom">
				Select month to display: &nbsp; <apex:selectList value="{!monthSelection}" size="1">
        			<apex:selectOptions value="{!selectMonth}" />
        			<apex:actionSupport event="onchange" rerender="month" />
        		</apex:selectList>
				<apex:commandButton value="Next" action="{!page3}" />
				<apex:commandButton value="Clear Fields" action="{!clear}" />
				<apex:commandButton value="Show all systems" action="{!allCal}" />
			</apex:pageBlockButtons>
			<apex:pageBlockSection title="Search Fields">
				<apex:inputField value="{!rental.Rental_System__c}" />
				<apex:inputField value="{!rentsystem.Owner__c}" />
			</apex:pageBlockSection>
		</apex:pageBlock>
	</apex:form>
	<apex:form >
        <apex:outputPanel id="month" />
        <apex:messages />
	</apex:form>
</apex:page>

 

 

The controller methods are as follows:

 

    private Map<String,Integer> monthMap = new Map<String,Integer>{'January'=>1,'February'=>2,'March'=>3,'April'=>4,'May'=>5,'June'=>6,'July'=>7,'August'=>8,'September'=>9,'October'=>10,'November'=>11,'December'=>12};
    private List<Month> monthlist;
    public String monthSelection{get;}
    public void setMonthSelection(String smonth){
    	if(smonth == null){smonth = this.month.getMonthName()+' '+this.month.getYearName();}
    	Date d;
    	Integer year = Integer.valueOf(smonth.split(' ',2).get(1));
    	Integer day = 1;
    	Integer month = monthMap.get(smonth.split(' ',2).get(0));
    	d = date.newInstance(year,month,day);
    	setMonth(d);
    }
    public List<SelectOption> getSelectMonth(){
    	List<SelectOption> SelectMonth = new List<SelectOption>();
    	if(monthlist==null) {
			monthlist = new List<Month>();
    	for(Integer i=-18;i <= 18;i++){
    		addmonth(i);
    		monthlist.add(month);
    		addmonth(-i);
    	}
    	}
    	System.debug(monthlist.size());
    	SelectMonth.add(new SelectOption('Current',month.getMonthName()+' '+ month.getYearName()));
    	for(Integer i = 0; i < monthlist.size();i++)
    		{
    			SelectMonth.add(new SelectOption(monthlist.get(i).getMonthName() + ' ' + monthlist.get(i).getYearName(),monthlist.get(i).getMonthName() + ' ' + monthlist.get(i).getYearName()));
    		}
    	return SelectMonth;
    }
   public PageReference page3(){
   	getfoundSystems();
   	return Page.rental_cal;
   }

 

 

The following things happen:

When a month is selected in the SelectList the 'Next' button correctly navigates to the next page.

 

But as soon as no selection was made in the selectList, the page just refreshes instead of redirecting to the next page.

I tried setting the 'Next'-Button with immediate="true", but then any value entered in the other fields are not submitted to the class, so that i can not use them on the next page (which has the same controller).

 

<apex:messages /> generates the following output:

 

•j_id0:j_id2:j_id3:j_id4:j_id6: An error occurred when processing your submitted information. 

 

Could anyone give me some idea where this is coming from?

Can i maybe set a value for the selectList initially when no value is selected?

 

Regards,

hoomel

 

 

  • November 25, 2010
  • Like
  • 0

Hello,

 

i am currently having some trouble with the governor limits.

 

I wanted to add a new SelectList to my Visualforce page enabling the selection of the month to display and wrote the according methods in my Apex class:

 

 

    public List<Month> monthlist = new Month[36];
    public List<Month> getMonthlist(){
    	for(Integer i=-18;i <= 18;i++){
    		addmonth(i);
    		monthlist.add(month);
    		addmonth(-i);
    	}
    	return monthlist;
    }
    public List<SelectOption> getSelectMonth(){
    	List<SelectOption> SelectMonth = new SelectOption[getMonthList().size()];
    	List<Month> tempMonths = new Month[getMonthList().size()];
    	tempMonths.addAll(getMonthList());
    	System.debug(getMonthList().size());
    	for(Integer i = 0; i < getMonthList().size();i++)
    		{
    			SelectMonth.add(new SelectOption('Hallo','Hallo'));
    			//SelectMonth.add(new SelectOption(tempMonths.get(i).getMonthName() + ' ' + tempMonths.get(i).getYearName(),tempMonths.get(i).getMonthName() + ' ' + tempMonths.get(i).getYearName()));
    		}
    	return SelectMonth;
    }

 

When i now open the page, i get an error regarding the apex scritp statement being exceeded.

 

Before writing the above mentioned methods, the debug log shows this regarding the governor limits:

 

Number of SOQL queries: 4 out of 100
  Number of query rows: 77 out of 10000
  Number of SOSL queries: 0 out of 20
  Number of DML statements: 0 out of 100
  Number of DML rows: 0 out of 10000
  Number of script statements: 727 out of 200000
  Maximum heap size: 0 out of 3000000
  Number of callouts: 0 out of 10
  Number of Email Invocations: 0 out of 10
  Number of fields describes: 0 out of 100
  Number of record type describes: 0 out of 100
  Number of child relationships describes: 0 out of 100
  Number of picklist describes: 0 out of 100
  Number of future calls: 0 out of 10
  Number of find similar calls: 0 out of 10
  Number of System.runAs() invocations: 0 out of 20

 

How is it possible that the code i added uses so much script statements?

I do not understand that at the moment, maybe someone could clear that up for me.

 

If any more code is necessary to find the problem, i will provide it.

 

Regards,

hoomel

 

 

  • November 22, 2010
  • Like
  • 0

Hi,

 

we are currently a bit stuck at referencing the correct data that fit our needs.

 

Currently we are rendering a new line in calendar for any Rental Period in the database. The Rental Period contains a relationship to another custom object, which holds the product the customer has rented.

 

Right now, a new line is rendered for every Rental Period, regardless of periods that have the same product.

 

We would like to be able to do a subselect query to get every period start date for every product.

The subselect currently looks like this:

 

Select (Select Start__c, End__c From Rental_System__r) From Rental_Systems__c

 

From this subselect, we need to access specific fields.

I tried accessing Start__c on the VIsualforce page and in the Apex controller as you would do it for a 'normal' select query but that was not very successfull ;)

Is it in any way possible to directly access the values in the query?

 

Regards,

hoomel

 

  • November 16, 2010
  • Like
  • 0

Hello,

 

i am wondering if it is possible to access specific values of a map in a Visualforce page.

 

I would like to iterate over a map and select a specific value in the map by referencing its key.

 

For example like this: {!Map.key} gives out the value of the given key.

 

Is this in any way possible?

 

Regards,

hoomel

  • November 15, 2010
  • Like
  • 0

Hello,

i have written the following code in apex:

 

 

		public String getDateDiffs(){
			List<Rental__c> tmpRents = new List<Rental__c>();
			tmpRents.addAll(getVerleih());
			List<String> strRents = new String[tmpRents.size()];
			System.debug(tmpRents.size());
			List<List<String>> listList;
				for(Integer i = 0; i < tmpRents.size();i++){
				strRents.clear();
				Date start = tmpRents.get(i).Start__c;
				Date ende = tmpRents.get(i).End__c;
				Integer toFirst = month.getfirstDate().daysBetween(start);
				Integer length = start.daysBetween(ende);
				System.debug(tmpRents.size());
				System.debug(start);
				System.debug(ende);
				System.debug(toFirst);
				System.debug(length);
				strRents.add(toFirst,'|____');
				System.debug(strRents);
					for(Integer k = toFirst+1;k < length;k++){
						strRents.add(k,'_____');
					}
				strRents.add(toFirst+length,'____|');
				listList.add(i,strRents);
				}
			return strRents.get(0);
		}

 

 

It adds a string to a list on a certain position. This position is determined by the difference between a start date from the database and the beginning of the currently selected month.

 

When calling the method on a visualforce page, i get the message: List Index Out of Bounds: 0

 

I added every variable in a System.debug() to determine where the error comes from but i am not getting any wiser from the debug log:

 

 

16:12:07.094|METHOD_ENTRY|[326]|LIST.size()
16:12:07.094|METHOD_EXIT|[326]|LIST.size()
16:12:07.094|USER_DEBUG|[326]|DEBUG|27
16:12:07.094|METHOD_EXIT|[326]|System.debug(ANY)
16:12:07.095|METHOD_ENTRY|[327]|System.debug(ANY)
16:12:07.095|USER_DEBUG|[327]|DEBUG|2010-11-01 00:00:00
16:12:07.095|METHOD_EXIT|[327]|System.debug(ANY)
16:12:07.095|METHOD_ENTRY|[328]|System.debug(ANY)
16:12:07.095|USER_DEBUG|[328]|DEBUG|2010-11-05 00:00:00
16:12:07.095|METHOD_EXIT|[328]|System.debug(ANY)
16:12:07.095|METHOD_ENTRY|[329]|System.debug(ANY)
16:12:07.095|USER_DEBUG|[329]|DEBUG|0
16:12:07.095|METHOD_EXIT|[329]|System.debug(ANY)
16:12:07.095|METHOD_ENTRY|[330]|System.debug(ANY)
16:12:07.095|USER_DEBUG|[330]|DEBUG|4
16:12:07.095|METHOD_EXIT|[330]|System.debug(ANY)
16:12:07.095|METHOD_ENTRY|[331]|LIST.add(Integer, ANY)
16:12:07.095|EXCEPTION_THROWN|[331]|System.ListException: List index out of bounds: 0
16:12:07.095|METHOD_EXIT|[331]|LIST.add(Integer, ANY)
16:12:07.095|CODE_UNIT_FINISHED|calCon invoke(getdatediffs)
16:12:07.095|CODE_UNIT_FINISHED|calCon get(datediffs)

 

 

Judging from the debug log output, the position where the '|____' is inserted would be 0.

It seems that i am doing some minor mistake that i do not see it right now.

I defined the size of the list and judging from the debug output, it should be 27 in this case.

 

In the documentation for the list methods, it is described as follows:

 

add	Integer i
Any type e
Void	Inserts an element e into the list at index position i. In the following example, a list with six elements is created, and integers are added to the first and second index positions.
List<Integer> myList = new Integer[6];
myList.add(0, 47);
myList.add(1, 52);
system.assertEquals(myList.get(1), 52);

 

It says for the add() method that you can have the Integer as a pointer and add the desired value.

Maybe i am overlooking something?

I would appreciate any help.

 

Regards,

hoomel

 

  • November 11, 2010
  • Like
  • 0

Hello,

 

i am desperately trying to find a way to pass a value from a Visualforce page to my custom controller without the user having to do something.

 

The background is that i have some nested apex:repeat-elements and i need a value from the first repeat passed to the controller to execute a database query comparing that value and use the result as a list for the second apex:repeat.

 

Is this somehow possible?

 

I already thought about using apex:inputHidden to set the value to the field and pass it to the controller but as i understand it, i need to call an action to pass the value, is that correct?

  • November 08, 2010
  • Like
  • 0

Hello, 

 

i am currently at the last steps to finish programming a calendar to display rental periods of products.

 

Since the final productive environment could have quite big amounts of data, i started testing by entering some dummy data.

Just before the calendar is finally rendered, i get the error message 'Response size exceeded 15MB organization limit' .

To work on this issue I now need to know what data exactly contribute to this size and if there are general possibilities to reduce this size.

Since the amount seems pretty huge to me, is this 'response size' the sum of all data from Apex and Visualforce or only Apex calls or Visualforce data?

 

If you need any other information, i will be glad to provide it and I hope someone could give me a hint.

 

Regards,

hoomel

  • November 03, 2010
  • Like
  • 0

Hello,

I am currently trying to build a quite big soql query.

This query should result in a list of custom objects which are filtered by values entered by a user via a form i built.

There are two lookup fields in this form where the user can select the correlating account and one other custom object.

I am getting the IDs from the fields as ID type so that there is no problem with 15 vs 18-character IDs.

The problem is now that the form should be exclusively searching for values in those fields that were entered by the user.

 

Right now, if i don't select a value in both fields, the query results in an error.

Here is my method executing the query:

 

public PT_System__c ptsystem;
public Rental__c rental;
public String accString; public Id searchAccount; public String sysString; public Id searchSystem;

public List<Rental__c> getFilteredAnlagen(){
           if(rental.PT_System__c != null){
               sysString = rental.PT_System__c;
               searchSystem = (Id)sysString;
               }else{searchSystem = '%';}
           if(rental.account__c != null){
               accString = rental.account__c;
               searchAccount = (Id)accString;
           }else{searchAccount = '%';}
           if(String.valueOf(rental.Start__c) != '' || rental.Start__c != null){
               searchStart = String.valueOf(rental.Start__c);
           }else{searchStart = '%'+String.valueOf(rental.Start__c);}
                  return [select Id, Name
                          FROM Rental__c
                          WHERE PT_System__r.RecordType.Name = 'Rental System'
                          AND PT_System__r.Id = :searchSystem
                          AND Account__c = :searchAccount
                          order by name];
       }

 As you can see, i used the '%' as a wildcard like i would use it for a string, which obviously is not working.

How can i check, if the related fields are selected and only search for those entries in the query when they are.

Or is there any other wildcard character that can be used for an ID?

The problem is, that there are a couple more fields in the form that should be able to be searched in without having to select an account or System.

 

I would appreciate any help with this, as i am totally stuck with it right now.

 

  • September 29, 2010
  • Like
  • 0

Hello,

 

i'm currently building a search form where the user can enter search criteria for various fields.

One of those fields is a related Account field.

I am writing the values the user entered into a class variable to use them in a query.

After some troubleshooting I finally read that there are two types of IDs.

Now I am a little bit stuck with truncating the ID i get in a query to compare it with the 15-character ID i get in the lookup field.

 

//the custom object from which i get the fields
public PT_System__c ptsystem;
//the variable where the Account ID from the user field is stored
public String searchAccount;
//this is the query method
public List<PT_System__c> getFilteredAnlagen(){
   		if(ptsystem.name !='' || ptsystem.name != null){
   			searchSystem = '%'+ptsystem.name+'%';
   			}else{searchSystem = '%';}
   		if(ptsystem.account__c != null){
   			searchAccount = ptsystem.account__c+'___';
   		}else{searchAccount = '%';}
  				return [select Id, Name FROM PT_System__c p WHERE p.RecordType.Name='Rental System' AND Name like :searchSystem AND Account__c like :searchAccount order by Name];
   	}

 

 

Currently I am getting an 'invalid operator on field id' error with the query.

Is there any possibility to work my way around this?

The easiest way I think would be to just cut the last 3 characters of the ID field from the query but I have no idea how to accomplish that.

Or is there some other possibility to compare the different IDs?

I would appreciate any help, because that would be one big step to completing my search form.

  • September 29, 2010
  • Like
  • 0

Hello,

 

i just noticed a problem with css files in packages.

I uploaded a css file along with some image files as a .zip package into the static resources.

This css file is correctly loaded and used in a visualforce page i created myself.

 

The problem now is, if i change anything on the visualforce page the css file is never loaded until i upload it again.

There is no difference between changes being made through the online editing tool for this page and changes being uploaded through the force.com IDE software.

 

Is there any known reason for this behaviour?

It is not a problem blocking the further development or customization but it is annoying to always upload the whole package again.

I hope there is any possibility to work around this inconvience.

  • September 15, 2010
  • Like
  • 0

Hello,

 

I have run into a problem with using IF conditions in apex:repeat.

 

I have various translated description fields that are referenced in the apex:repeat. If the field for the specific language (Japanese) is empty, the standard english language needs to be used.

This is my code:

<apex:repeat value="{!Quotelist2}" var="l2">
	<tr style="font-size:80%;font-family:Arial Unicode MS;">
		<td valign="top">{!IF(10 > cnt,"0","")}{!FLOOR(cnt)}</td>
		<td valign="top">{!l2.Item__r.Item_name__c}</td>
		<td valign="top">{!IF(l2.Item__r.Short_description_japanese__c = "",l2.Item__r.Short_description_english__c,l2.Item__r.Short_description_japanese__c)}</td>
	</tr>
<apex:variable var="cnt" value="{!cnt+1}" />
</apex:repeat>

 When saving it like this in Force.com IDE, I get "Save error: Unknown property: pdfData.l2"

 

pdfData is the name of the controller, but l2 should simply be the variable the apex:repeat provides, doesn't it?

 

What am I overlooking here?

 

Thanks in advance and Best Regards,

hoomel

  • August 07, 2013
  • Like
  • 0

Hi,

 

I created a trigger on the User object, to fill a field with the date on which the user was activated, respectively deactivated.

 

When a new user is created, the current date should also be put in a field. This especially causes a LICENSE_LIMIT_EXCEEDED.

Why exactly is this caused and how can I avoid it?

 

Here's the code:

trigger userTrigger on User (before update, before insert) {
	private User[] newUser = Trigger.new;
	private User[] oldUser;
	if(Trigger.isUpdate){oldUser = Trigger.old;
		if(oldUser[0].isActive == false && newUser[0].isActive == true){
			newUser[0].Last_Inactive__c = System.now();
		}
		if(oldUser[0].isActive == true && newUser[0].isActive == false){
			newUser[0].Last_Active__c = System.now();
		}
	}
	if(Trigger.isInsert){newUser[0].Last_Inactive__c = System.now();}
}

 Thanks for the help in advance,

 

Regards,

hoomel

  • March 21, 2013
  • Like
  • 0

Hello,

 

as I am aware, Triggers on the User object are a bit 'hinky' but a customer had a requirement for a trigger.

 

This is the Trigger I wrote:

trigger userTrigger on User (before insert, before update) {
	private User[] newUser = Trigger.new;
	private User[] oldUser = Trigger.old;
	
	if(oldUser[0].isActive == false && newUser[0].isActive == true){
		newUser[0].Last_Inactive__c = System.now();
	}
	if(oldUser[0].isActive == true && newUser[0].isActive == false){
		newUser[0].Last_Active__c = System.now();
	}
}


System.DmlException: Insert failed. First exception on row 0; first error: CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY, userTrigger: execution of BeforeInsert caused by: System.NullPointerException: Attempt to de-reference a null object

Trigger.userTrigger: line 5, column 1: []    Plasma_Production        line 1    Force.com run test failure

What can I do about it? I am currently out of ideas how to get around this error.

 

Thanks in advance,

hoomel

  • February 21, 2013
  • Like
  • 0

Hello,

 

I am having some trouble with chinese characters in PDF generation.

I do not know any chinese, but the customer gave me a document to copy the text excerpts from and I have already done that. What strikes me as odd is that most of the characters show up, but some just don't.

Wherever I want to insert them in the page, they are not shown in the PDF.

 

Is there any reason why this is happening?

This is one of the text excerpts that do not show up anywhere on the page: 设备租用报价

 

Maybe I have to set some enconding parameters in the header?

 

Thanks for any advice.

 

Best Regards,

Marc

  • February 21, 2012
  • Like
  • 0

Hello,

 

I would enable the our users to select any document from a folder an attach it to an email.

I already have the functionality to select existing attachments and to upload a file, but I do not seem to get the correct list of document folders.

 

What I would like to do is:

A drop-down selectList to select the documents' folder.

Then a selectList to show the documents in the selected folder and let the user select the documents he wants to attach to the emailMessage.

 

Currently this is where I am stuck. The list of folders always contains every users' personal folder. I would rather use the same list that is displayed when accessing the Document object.

Is there any way to mimic the behavior of that picklist?

 

Regards,

hoomel

  • August 11, 2011
  • Like
  • 0

Hello,

 

I am currently having some trouble with a very unspecific error message.

An internal server error has occurred
An error has occurred while processing your request. The salesforce.com support team has been notified of the problem. If you believe you have additional information that may be of help in reproducing or correcting the error, please contact Salesforce Support. Please indicate the URL of the page you were requesting, any error id shown on this page as well as any other related information. We apologize for the inconvenience.

Thank you again for your patience and assistance. And thanks for using salesforce.com!

Error ID: 1532630577-98471 (-2023769877) 

 

It happens as soon as I remove the {get;set;} from a List<String> and write the getter-methods separately.

 

This is what causes the error:

public List<String> toList;
public List<String> ccList;
public List<String> getToList(){
		return toList;
	}
public List<String> getCCList(){
		return ccList;
	}

  And this is how the error disappears:

	public List<String> toList{get;set;}
	public List<String> ccList{get;set;}

 

As the error message does not give any information at all, is it possible to find out more about what is causing the error?

Or is there something wrong how I wrote the getter-method? I do not expect that to be the problem, because I did that a couple of times before, but maybe there is something wrong?

 

Maybe there is a possibility to search for that Error ID to get some more information? I could not find anything in that direction.

 

This currently stops my progress, so any hint at all would be great!

 

Regards,

hoomel

  • August 09, 2011
  • Like
  • 0

Hello,

 

i have fairly general question, but i cannot seem to find any information on this matter:

 

What exactly is the difference between SingleEmailMessage and MassEmailMessage?

 

This is what i know:

  • They both count against different organisation limits

From the Apex Code Documentation I concluded that I can add multiple targetObjectIds for a MassEmail and only one for a single email. Is that correct?

So a MassEmail could be logged as an activity for multiple contacts and a SingleEmail could be logged only for one contact?

 

Maybe someone can confirm this or clear out the differences to me?

 

Regards,

hoomel

  • August 04, 2011
  • Like
  • 0

Hello,

 

i am currently trying to create a Visualforce page which extends the "Send an Email"-functionality.

What I would like to do is create a lookup field for an account and then automatically populate a selectList with the related contacts to that account.

 

Is this in any way possible? The most challenging thing is assigning the selected account to a variable to query the list of contacts from it. Everything else should be fairly basic stuff.

 

Maybe someone has a hint for me.

 

Regards,

hoomel

  • August 02, 2011
  • Like
  • 0

Hello,

 

i wrote pretty basic data collecting class in Apex for generating a PDF document.

This is the class:

 

public with sharing class pdfData {
	public String sys = Apexpages.currentPage().getParameters().get('sys');
	public String userID = UserInfo.getUserId();
	public Integer lineCount = 0;
	public Integer maxLines = 21;
	public List<ItemSystemRelation__c> list1 = new List<ItemSystemRelation__c>();
	public List<ItemSystemRelation__c> list2 = new List<ItemSystemRelation__c>();
	public User curUser = [Select Street, PostalCode, City FROM User WHERE Id = :userID];
	public Rental__c rental = [Select Id, Name,Period__c, Owner.Name, Rental_fee__c, Calculation_starts_week__c, Start__c, End__c, Account_ERP_No__c,Account_Tax_number__c, Account_City__c, Account_Street__c, Account_Zip_Code__c, Account__r.Name FROM Rental__c WHERE Rental_System__c = :sys limit 1];
	public Rental_Systems__c rsystem = [Select Id, Name, System_Name__c FROM Rental_Systems__c WHERE Id = :sys limit 1];
	private List<ItemSystemRelation__c> items = [Select Item__r.Short_description__c, Item__r.Name, Item__r.Item_Name__c FROM ItemSystemRelation__c WHERE Rental_System__c = :sys AND Item__r.Active__c = true order by Item__r.Name];
	public String curDate = system.today().format();
	public pdfData(){
	}
	public Rental__c getRental(){
		return rental;
	}
	public Rental_Systems__c getRSystem(){
		return rsystem;
	}
	public String getToday(){
		return System.today().format();
	}
	public String getStart(){
		return rental.Start__c.format();
	}
	public String getEnd(){
		return rental.End__c.format();
	}
	public User getUser(){
		return curUser;
	}
	public Integer getItemCount(){
		return items.size();
	}
	public List<ItemSystemRelation__c> getItems(){
		return items;
	}
	public String getCurDate(){
		return curDate;
	}
	public void populateLists(){
		Integer totalLines = 0;
		for(Integer i = 0;i < items.size();i++){
			if(items.get(i).Item__r.Short_description__c != null){
				totalLines = math.round(totalLines + items.get(i).Item__r.Short_description__c.length()/80);
			}else{
				totalLines++;
			}
			if(totalLines < maxLines){
				System.debug(items.get(i));
				list1.add(items.get(i));
			}else{
				list2.add(items.get(i));
			}
		}
	}
	public List<ItemSystemRelation__c> getList1(){
		populateLists();
		return list1;
	}
	public Integer getSize1(){
		return list1.size();
	}
	public List<ItemSystemRelation__c> getList2(){
		return list2;
	}
	public Boolean getShowList2(){
		if(list2.size() < 1){return false;}else{return true;}
	}

 

 

I am now writing the test methods to deploy it in production, but it fails at the database query where the URL parameter is used.

How can I set this variable when creating a new instance of the class in the beginning of my test method?

Or is there any way around this problem?

 

Regards,

hoomel

 

  • February 15, 2011
  • Like
  • 0

Hello,

 

i built a Visualforce page where the user can input search criteria. It looks like this:

 

<apex:page controller="calCon">
<apex:sectionHeader title="Search assistant" subtitle="Step 1 of 2"/>
	<apex:form >
		<apex:pageBlock title="Enter search criteria here" mode="detail">
			<apex:pageBlockButtons location="bottom">
				Select month to display: &nbsp; <apex:selectList value="{!monthSelection}" size="1">
        			<apex:selectOptions value="{!selectMonth}" />
        			<apex:actionSupport event="onchange" rerender="month" />
        		</apex:selectList>
				<apex:commandButton value="Next" action="{!page3}" />
				<apex:commandButton value="Clear Fields" action="{!clear}" />
				<apex:commandButton value="Show all systems" action="{!allCal}" />
			</apex:pageBlockButtons>
			<apex:pageBlockSection title="Search Fields">
				<apex:inputField value="{!rental.Rental_System__c}" />
				<apex:inputField value="{!rentsystem.Owner__c}" />
			</apex:pageBlockSection>
		</apex:pageBlock>
	</apex:form>
	<apex:form >
        <apex:outputPanel id="month" />
        <apex:messages />
	</apex:form>
</apex:page>

 

 

The controller methods are as follows:

 

    private Map<String,Integer> monthMap = new Map<String,Integer>{'January'=>1,'February'=>2,'March'=>3,'April'=>4,'May'=>5,'June'=>6,'July'=>7,'August'=>8,'September'=>9,'October'=>10,'November'=>11,'December'=>12};
    private List<Month> monthlist;
    public String monthSelection{get;}
    public void setMonthSelection(String smonth){
    	if(smonth == null){smonth = this.month.getMonthName()+' '+this.month.getYearName();}
    	Date d;
    	Integer year = Integer.valueOf(smonth.split(' ',2).get(1));
    	Integer day = 1;
    	Integer month = monthMap.get(smonth.split(' ',2).get(0));
    	d = date.newInstance(year,month,day);
    	setMonth(d);
    }
    public List<SelectOption> getSelectMonth(){
    	List<SelectOption> SelectMonth = new List<SelectOption>();
    	if(monthlist==null) {
			monthlist = new List<Month>();
    	for(Integer i=-18;i <= 18;i++){
    		addmonth(i);
    		monthlist.add(month);
    		addmonth(-i);
    	}
    	}
    	System.debug(monthlist.size());
    	SelectMonth.add(new SelectOption('Current',month.getMonthName()+' '+ month.getYearName()));
    	for(Integer i = 0; i < monthlist.size();i++)
    		{
    			SelectMonth.add(new SelectOption(monthlist.get(i).getMonthName() + ' ' + monthlist.get(i).getYearName(),monthlist.get(i).getMonthName() + ' ' + monthlist.get(i).getYearName()));
    		}
    	return SelectMonth;
    }
   public PageReference page3(){
   	getfoundSystems();
   	return Page.rental_cal;
   }

 

 

The following things happen:

When a month is selected in the SelectList the 'Next' button correctly navigates to the next page.

 

But as soon as no selection was made in the selectList, the page just refreshes instead of redirecting to the next page.

I tried setting the 'Next'-Button with immediate="true", but then any value entered in the other fields are not submitted to the class, so that i can not use them on the next page (which has the same controller).

 

<apex:messages /> generates the following output:

 

•j_id0:j_id2:j_id3:j_id4:j_id6: An error occurred when processing your submitted information. 

 

Could anyone give me some idea where this is coming from?

Can i maybe set a value for the selectList initially when no value is selected?

 

Regards,

hoomel

 

 

  • November 25, 2010
  • Like
  • 0

Hello,

 

i am currently having some trouble with the governor limits.

 

I wanted to add a new SelectList to my Visualforce page enabling the selection of the month to display and wrote the according methods in my Apex class:

 

 

    public List<Month> monthlist = new Month[36];
    public List<Month> getMonthlist(){
    	for(Integer i=-18;i <= 18;i++){
    		addmonth(i);
    		monthlist.add(month);
    		addmonth(-i);
    	}
    	return monthlist;
    }
    public List<SelectOption> getSelectMonth(){
    	List<SelectOption> SelectMonth = new SelectOption[getMonthList().size()];
    	List<Month> tempMonths = new Month[getMonthList().size()];
    	tempMonths.addAll(getMonthList());
    	System.debug(getMonthList().size());
    	for(Integer i = 0; i < getMonthList().size();i++)
    		{
    			SelectMonth.add(new SelectOption('Hallo','Hallo'));
    			//SelectMonth.add(new SelectOption(tempMonths.get(i).getMonthName() + ' ' + tempMonths.get(i).getYearName(),tempMonths.get(i).getMonthName() + ' ' + tempMonths.get(i).getYearName()));
    		}
    	return SelectMonth;
    }

 

When i now open the page, i get an error regarding the apex scritp statement being exceeded.

 

Before writing the above mentioned methods, the debug log shows this regarding the governor limits:

 

Number of SOQL queries: 4 out of 100
  Number of query rows: 77 out of 10000
  Number of SOSL queries: 0 out of 20
  Number of DML statements: 0 out of 100
  Number of DML rows: 0 out of 10000
  Number of script statements: 727 out of 200000
  Maximum heap size: 0 out of 3000000
  Number of callouts: 0 out of 10
  Number of Email Invocations: 0 out of 10
  Number of fields describes: 0 out of 100
  Number of record type describes: 0 out of 100
  Number of child relationships describes: 0 out of 100
  Number of picklist describes: 0 out of 100
  Number of future calls: 0 out of 10
  Number of find similar calls: 0 out of 10
  Number of System.runAs() invocations: 0 out of 20

 

How is it possible that the code i added uses so much script statements?

I do not understand that at the moment, maybe someone could clear that up for me.

 

If any more code is necessary to find the problem, i will provide it.

 

Regards,

hoomel

 

 

  • November 22, 2010
  • Like
  • 0

Hi,

 

we are currently a bit stuck at referencing the correct data that fit our needs.

 

Currently we are rendering a new line in calendar for any Rental Period in the database. The Rental Period contains a relationship to another custom object, which holds the product the customer has rented.

 

Right now, a new line is rendered for every Rental Period, regardless of periods that have the same product.

 

We would like to be able to do a subselect query to get every period start date for every product.

The subselect currently looks like this:

 

Select (Select Start__c, End__c From Rental_System__r) From Rental_Systems__c

 

From this subselect, we need to access specific fields.

I tried accessing Start__c on the VIsualforce page and in the Apex controller as you would do it for a 'normal' select query but that was not very successfull ;)

Is it in any way possible to directly access the values in the query?

 

Regards,

hoomel

 

  • November 16, 2010
  • Like
  • 0

Hello,

i have written the following code in apex:

 

 

		public String getDateDiffs(){
			List<Rental__c> tmpRents = new List<Rental__c>();
			tmpRents.addAll(getVerleih());
			List<String> strRents = new String[tmpRents.size()];
			System.debug(tmpRents.size());
			List<List<String>> listList;
				for(Integer i = 0; i < tmpRents.size();i++){
				strRents.clear();
				Date start = tmpRents.get(i).Start__c;
				Date ende = tmpRents.get(i).End__c;
				Integer toFirst = month.getfirstDate().daysBetween(start);
				Integer length = start.daysBetween(ende);
				System.debug(tmpRents.size());
				System.debug(start);
				System.debug(ende);
				System.debug(toFirst);
				System.debug(length);
				strRents.add(toFirst,'|____');
				System.debug(strRents);
					for(Integer k = toFirst+1;k < length;k++){
						strRents.add(k,'_____');
					}
				strRents.add(toFirst+length,'____|');
				listList.add(i,strRents);
				}
			return strRents.get(0);
		}

 

 

It adds a string to a list on a certain position. This position is determined by the difference between a start date from the database and the beginning of the currently selected month.

 

When calling the method on a visualforce page, i get the message: List Index Out of Bounds: 0

 

I added every variable in a System.debug() to determine where the error comes from but i am not getting any wiser from the debug log:

 

 

16:12:07.094|METHOD_ENTRY|[326]|LIST.size()
16:12:07.094|METHOD_EXIT|[326]|LIST.size()
16:12:07.094|USER_DEBUG|[326]|DEBUG|27
16:12:07.094|METHOD_EXIT|[326]|System.debug(ANY)
16:12:07.095|METHOD_ENTRY|[327]|System.debug(ANY)
16:12:07.095|USER_DEBUG|[327]|DEBUG|2010-11-01 00:00:00
16:12:07.095|METHOD_EXIT|[327]|System.debug(ANY)
16:12:07.095|METHOD_ENTRY|[328]|System.debug(ANY)
16:12:07.095|USER_DEBUG|[328]|DEBUG|2010-11-05 00:00:00
16:12:07.095|METHOD_EXIT|[328]|System.debug(ANY)
16:12:07.095|METHOD_ENTRY|[329]|System.debug(ANY)
16:12:07.095|USER_DEBUG|[329]|DEBUG|0
16:12:07.095|METHOD_EXIT|[329]|System.debug(ANY)
16:12:07.095|METHOD_ENTRY|[330]|System.debug(ANY)
16:12:07.095|USER_DEBUG|[330]|DEBUG|4
16:12:07.095|METHOD_EXIT|[330]|System.debug(ANY)
16:12:07.095|METHOD_ENTRY|[331]|LIST.add(Integer, ANY)
16:12:07.095|EXCEPTION_THROWN|[331]|System.ListException: List index out of bounds: 0
16:12:07.095|METHOD_EXIT|[331]|LIST.add(Integer, ANY)
16:12:07.095|CODE_UNIT_FINISHED|calCon invoke(getdatediffs)
16:12:07.095|CODE_UNIT_FINISHED|calCon get(datediffs)

 

 

Judging from the debug log output, the position where the '|____' is inserted would be 0.

It seems that i am doing some minor mistake that i do not see it right now.

I defined the size of the list and judging from the debug output, it should be 27 in this case.

 

In the documentation for the list methods, it is described as follows:

 

add	Integer i
Any type e
Void	Inserts an element e into the list at index position i. In the following example, a list with six elements is created, and integers are added to the first and second index positions.
List<Integer> myList = new Integer[6];
myList.add(0, 47);
myList.add(1, 52);
system.assertEquals(myList.get(1), 52);

 

It says for the add() method that you can have the Integer as a pointer and add the desired value.

Maybe i am overlooking something?

I would appreciate any help.

 

Regards,

hoomel

 

  • November 11, 2010
  • Like
  • 0

Hello, 

 

i am currently at the last steps to finish programming a calendar to display rental periods of products.

 

Since the final productive environment could have quite big amounts of data, i started testing by entering some dummy data.

Just before the calendar is finally rendered, i get the error message 'Response size exceeded 15MB organization limit' .

To work on this issue I now need to know what data exactly contribute to this size and if there are general possibilities to reduce this size.

Since the amount seems pretty huge to me, is this 'response size' the sum of all data from Apex and Visualforce or only Apex calls or Visualforce data?

 

If you need any other information, i will be glad to provide it and I hope someone could give me a hint.

 

Regards,

hoomel

  • November 03, 2010
  • Like
  • 0