• dipu2
  • NEWBIE
  • 5 Points
  • Member since 2011

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 15
    Questions
  • 10
    Replies

I have been trying to create a master detail relation field with Product2 as the master object. 

I do not see Product in the list of available objects in the Related to list.

 

Is it possible to use Product2 as master object?

 

Thanks,

Dipu

  • January 11, 2013
  • Like
  • 0

I am trying to enter html into Rich Text field. The html I enter is displayed as html tag.

For example if I enter <b>Title</b> it is displayed as <b>Title</b> instead of displaying the word Title in bold.

  • January 10, 2013
  • Like
  • 0

[SELECT Id, Name, AccountId FROM Contact WHERE NOT(Name LIKE '%orbs%') AND AccountId='001E000000M4pZEIAZ' LIMIT 4]

 

Cannot figure out what is wrong in this SOQL WHERE clause combining NOT LIKE with another clause?

  • December 06, 2012
  • Like
  • 0

In my Apex code I want to log about the ID with no finformation about the corresponding SObject. How can I find what is the SObject for a given external Id?

  • November 28, 2012
  • Like
  • 0
Sometimes I get this error message.Have anybody come across this yet? I am using Chrome browser.
<apex:inputText> element value must resolve to a String type!

 

  • August 31, 2012
  • Like
  • 0

 I have noticed a lot of these Heap Allocate in the debug log. Should I be concerned about heap allocation. Is there a way to allocate a bigger chunk instead of repeated allocation.

 

11:29:24.883 (3883710000)|HEAP_ALLOCATE|[EXTERNAL]|Bytes:52
11:29:24.883 (3883723000)|HEAP_ALLOCATE|[EXTERNAL]|Bytes:52
11:29:24.883 (3883734000)|HEAP_ALLOCATE|[EXTERNAL]|Bytes:52
11:29:24.883 (3883742000)|HEAP_ALLOCATE|[EXTERNAL]|Bytes:52
11:29:24.883 (3883750000)|HEAP_ALLOCATE|[EXTERNAL]|Bytes:52
11:29:24.883 (3883758000)|HEAP_ALLOCATE|[EXTERNAL]|Bytes:52
11:29:24.883 (3883766000)|HEAP_ALLOCATE|[EXTERNAL]|Bytes:52
11:29:24.883 (3883775000)|HEAP_ALLOCATE|[EXTERNAL]|Bytes:52
11:29:24.883 (3883788000)|HEAP_ALLOCATE|[EXTERNAL]|Bytes:52
11:29:24.883 (3883797000)|HEAP_ALLOCATE|[EXTERNAL]|Bytes:52
11:29:24.883 (3883808000)|HEAP_ALLOCATE|[EXTERNAL]|Bytes:52
11:29:24.883 (3883816000)|HEAP_ALLOCATE|[EXTERNAL]|Bytes:52

 

  • May 11, 2012
  • Like
  • 0

VF Page with showHeader="false" are not working correctly in IE9. 

Looks like some of the JavaScript used in displaying the header fixes some the IE9 issues. Without the header inputText field value is not submitted to the server.

 

Please find attached my sample code below. When I uncheck the showHeader check box and enter page number 1 it takes the input. On second entry as page number 2 the value is not submitted to the server and hence the page number value is set back to 1. Now try with showHeader as checked. The page shows the tabs. Now the page number entries are sent correctly to the server. 

 

<apex:page controller="DDTestIE9" 
			showHeader="{!showHeader}">
	<apex:form id="idForm">
		<apex:outputPanel >	
			Enter the page number several times
			<br/>
			onChange action support added to the page number input field
		</apex:outputPanel>
		<br/><br/><br/>
		<apex:outputPanel >	
			<apex:outputLabel value="Show Header"></apex:outputLabel>
			<apex:inputCheckbox value="{!showHeader}">
				<apex:actionSupport event="onchange" action="{!loadPage}"/>
			</apex:inputCheckbox>
		</apex:outputPanel>
		<br/>
		<hr/>
		
		<apex:outputPanel id="idProductsBlock">
		<table><tr>
			<td width="100">
				<apex:actionStatus id="idPageChangeStatus" 
			                       startText="Loading..."
			                       stopText=""/>
			</td>
			<td >
				<apex:outputPanel >	
					<apex:outputLabel value="Page Number"></apex:outputLabel>
					<apex:inputText value="{!pageNumber}">
						<apex:actionSupport event="onchange" action="{!loadPage}" 
											rerender="idProductsBlock" 
											status="idPageChangeStatus"/>
					</apex:inputText>
				</apex:outputPanel>	
			</td>
			<td>
				<apex:outputPanel id="idLastPageNumber">
					<apex:outputLabel value="Last Page Number: "></apex:outputLabel>
					<apex:outputText value="{!pageNumber}"/>
					
				</apex:outputPanel>
			</td>
		</tr></table>
		</apex:outputPanel>	
	</apex:form>
</apex:page>

 

Here is my controller code

 

public with sharing class DDTestIE9 {
	private Integer pNumber = 0;
	
	public Boolean showHeader{get; set;}
	public DDTestIE9(){
		showHeader = true;
	}
	public Integer getPageNumber(){
		return pNumber;	
	}
	public void setPageNumber(Integer pageNumber){
		this.pNumber = pageNumber;	
		System.debug('setPageNumber = ' +pNumber);	
	}
	public void loadPage(){
		System.debug('loadPage pNumber = ' +pNumber);	
	
	}

}

 

 

 

 

  • February 24, 2012
  • Like
  • 0

JavaScript Remoting still requires the controller function to be global in a managed package.

I thoiught in Spring 12 this restriction would be removed. 

  • February 09, 2012
  • Like
  • 0

My debug log gets truncated in Apex Test Runner. 

The debug log is filled with the following statements. Is there a way to avoid including these statements so that my debug log is not truncated.

10:53:16.582 (14582455000)|SYSTEM_METHOD_ENTRY|[14]|LIST.iterator()
10:53:16.582 (14582914000)|SYSTEM_METHOD_EXIT|[14]|LIST.iterator()
10:53:16.583 (14583289000)|SYSTEM_METHOD_ENTRY|[14]|system.ListIterator.hasNext()
10:53:16.583 (14583318000)|SYSTEM_METHOD_EXIT|[14]|system.ListIterator.hasNext()
10:53:16.583 (14583347000)|SYSTEM_METHOD_ENTRY|[14]|system.ListIterator.next()
10:53:16.583 (14583379000)|SYSTEM_METHOD_EXIT|[14]|system.ListIterator.next()
10:53:16.583 (14583473000)|SYSTEM_METHOD_ENTRY|[15]|LIST.add(ANY)
10:53:16.583 (14583552000)|SYSTEM_METHOD_EXIT|[15]|LIST.add(ANY)

 

 

 

  • February 08, 2012
  • Like
  • 0

How do I put this syntax in VF page? I have getExtraColumn1Name() in the controller. My code is in managed package. I want to display custom fields added by our customer.

 

<apex:column rendered="{!showExtraColumn1}">
  <apex:outputField value="{!itemSO['ExtraColumn1Name']}" />
</apex:column>

 

value="{!itemSO[ExtraColumn1Name]}" gives an error message saying could not evaluate SampleTable__c[ExtraField1__c]  which is understandable. I do not see any way to place the quote around the fieldName in this syntax {!itemSO[<fieldName>] }.

 

Thanks,

Dipu

  • January 17, 2012
  • Like
  • 0

I just started to use JavaScript remoting. It seems the function called from JavaScript remoting should be global in a managed package.

Oh no, that is a bummer. I do not like to make any Apex class or function global unless it is extremely necessary. Once it is global I cannot change the name of the controller and the global function.  

 

Thanks,

Dipu

  • January 13, 2012
  • Like
  • 0

It iwill be nice to combine all discussion board post by email address. I have three accounts with same email address. I have even more dev accounts, which makes it harder to login to discussion board.

I would like to see all my posts under one handle since I use the same email account that should be possible.

 

Thanks,

Dipu

 

  • January 06, 2012
  • Like
  • 0

Is there a shorter way to get the field type of a named field. Field name is given to me. I want to know if it is a reference field.

String fieldName = 'BaseProductId__c';
System.assert(Schema.DisplayType.REFERENCE == Product2.sObjectType.getDescribe().fields.getMap().get(fieldName).getDescribe().getType());

 

  • January 06, 2012
  • Like
  • 0

I have remote actions in two different controllers. Is it possible to  invoke remote actions from two different controllers from single VF page?

 

 

  • December 01, 2011
  • Like
  • 0

I do not see the mini page layout view of the Product2 object. When I hover over the product field in any object 's detail view the mini page layout of the Product2 object does not popup. 

 

Thanks,

Dipu

  • September 28, 2011
  • Like
  • 0

First - I'm still stumbling my way around APEX so bear with me.

I'm trying to write a trigger that prevents our users from adding a specific product to opptys.

The trick here is that the sysadmin (me) and the product manager should be excluded and therefore allowed to add these products.  
So far, this works in general but I can't seem to get the exclude to work.

Ideas?  TIA

 

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
trigger OpportunityOEM on Opportunity (after update) {



  Map<ID, Opportunity> opstotest = new Map<ID, Opportunity>();
  
   // Only Product Managers can use this product
   for(Opportunity op: trigger.new)


  {
    {
      opstotest.put(op.id, op);  
    }
  }
  if(opstotest.size()==0) return;
    
  
  // Grab all product line items
  List<OpportunityLineItem> olis = [Select ID, OpportunityID from OpportunityLineItem where PriceBookEntry.Product2.Family='OEM' 
  ];

  
  Set<ID> opstofail = new Set<ID>();
  for(OpportunityLineItem oli: olis)
  {
    opstofail.add(oli.OpportunityID);
  }
  
  for(ID optofail: opstofail)
  {
  opstotest.get(optofail).addError('OEM products must be approved by Product Mgmt.');
  
  

  }
  
}

Hi All,

 

I have a trigger that creates a task for a set of criteria on a custom object called Implementation. Whenever a non system admin user enters in the Target Go Live Date on the implementation record, the Trainer listed on the Implementation record will have a task created for them. Currently, whenever this trigger fires for the after update portion, it creates two duplicate tasks. I've crawled through several debug logs and toggled things on and off and found that if I turn off one specific workflow rule, the duplication does not occur. 

 

Any thoughts or ideas on why this particular workflow is causing the trigger to run twice?

 

Here's the workflow: (updates the Target Go Live Month field when the Target Go Live Date field is changed)

- Evaluate the rule when a record is created, and every time it's edited

- Object: Implementation

ISCHANGED( Target_Go_Live_Date__c)

- Field update:

- Field to update: Implementation: Target Go Live Month

CASE( TEXT( MONTH( Target_Go_Live_Date__c)), 
"1", "01 - Jan", 
"2", "02 - Feb", 
"3", "03 - Mar", 
"4", "04 - Apr", 
"5", "05 - May", 
"6", "06 - Jun", 
"7", "07 - Jul", 
"8", "08 - Aug", 
"9", "09 - Sep", 
"10", "10 - Oct", 
"11", "11 - Nov", 
"12", "12 - Dec", 
"")

 

Here's the trigger:

trigger TargetGoLiveDateTrainerTask on Implementation_del__c (after insert, after update) {
  List<Task> tasks = new List<Task>();
  Id currentUserProfileId = UserInfo.getProfileId();
  Set<Id> implementationIds = new Set<Id>();
  Date taskDate = System.today();
  RecordType recordType = RecordTypeResolver.find('Task', 'Client Services');
  
  //Exclude all System Admins from creating this task
  if (new Set<Id> {'00e30000000dSKN'}.contains(currentUserProfileId))
    return;

  for (Integer i = 0; i < Trigger.size; i++) {

    if ((Trigger.isInsert || Trigger.old[i].Target_Go_Live_Date__c == null) &&
      (Trigger.new[i].Target_Go_Live_Date__c != null &&
       Trigger.new[i].Training_Required__c != 'No'))
        
      implementationIds.add(Trigger.new[i].Id);
  }
  
  if( implementationIds != null) {

    List<Implementation_del__c> implementations = new List<Implementation_del__c>([SELECT Id, Account__c, Trainer__c, Account__r.Name, Target_Go_Live_Date__c FROM Implementation_del__c WHERE Id IN :implementationIds]);
  
    for (Implementation_del__c implementation : implementations) {

      if (implementation.Trainer__c == null) {
        implementation.addError('Implementation has no Trainer set.  Please set a Trainer for the \'Training Kick Off Call\' Task to continue.  Contact an administrator for more information.');
      }

      else if (System.today().daysBetween(implementation.Target_Go_Live_Date__c) < 30) {
        tasks.add( new Task( Subject = 'Training Kick Off Call: ' + (implementation.Account__c != null ? implementation.Account__r.Name : '<Unknown>'),
                  OwnerId = implementation.Trainer__c,
                  ActivityDate = taskDate,
                   ReminderDateTime = System.today(),
                  IsReminderSet = True,
                  WhatId = implementation.Id,
                  RecordTypeId = recordType.Id ));
      }
      
      else {
        taskDate = implementation.Target_Go_Live_Date__c - 30;
        tasks.add( new Task( Subject = 'Training Kick Off Call: ' + (implementation.Account__c != null ? implementation.Account__r.Name : '<Unknown>'),
                 OwnerId = implementation.Trainer__c,
                 ActivityDate = taskDate,
                 ReminderDateTime = DateTime.newInstance(taskDate, Time.newInstance(8, 0, 0, 0)),
                 IsReminderSet = True,
                 WhatId = implementation.Id,
                 RecordTypeId = recordType.Id ));
      }
    }
    
    if(tasks != null)
      insert tasks;
  }

 

My debug log gets truncated in Apex Test Runner. 

The debug log is filled with the following statements. Is there a way to avoid including these statements so that my debug log is not truncated.

10:53:16.582 (14582455000)|SYSTEM_METHOD_ENTRY|[14]|LIST.iterator()
10:53:16.582 (14582914000)|SYSTEM_METHOD_EXIT|[14]|LIST.iterator()
10:53:16.583 (14583289000)|SYSTEM_METHOD_ENTRY|[14]|system.ListIterator.hasNext()
10:53:16.583 (14583318000)|SYSTEM_METHOD_EXIT|[14]|system.ListIterator.hasNext()
10:53:16.583 (14583347000)|SYSTEM_METHOD_ENTRY|[14]|system.ListIterator.next()
10:53:16.583 (14583379000)|SYSTEM_METHOD_EXIT|[14]|system.ListIterator.next()
10:53:16.583 (14583473000)|SYSTEM_METHOD_ENTRY|[15]|LIST.add(ANY)
10:53:16.583 (14583552000)|SYSTEM_METHOD_EXIT|[15]|LIST.add(ANY)

 

 

 

  • February 08, 2012
  • Like
  • 0

what is the diff b/w sObject and Object

 

what is sControl

 

currently i am learning to write code for triggers, classes , and test classes. Planning to learn about visualforce pages what is the next concept that i need to learn for improving my code development skills

 

I will be very glad for your time and help

Is there a possibility to use dynamic custom labels in apex. I know you can do this with VF, but i can't find it for apex. 

 

Custom label = 'You have used {0} in {1} Hours'

 

in apex

 

String text = Label.used(List<String>('12','2');

 

  • January 17, 2012
  • Like
  • 0

I just started to use JavaScript remoting. It seems the function called from JavaScript remoting should be global in a managed package.

Oh no, that is a bummer. I do not like to make any Apex class or function global unless it is extremely necessary. Once it is global I cannot change the name of the controller and the global function.  

 

Thanks,

Dipu

  • January 13, 2012
  • Like
  • 0

I have remote actions in two different controllers. Is it possible to  invoke remote actions from two different controllers from single VF page?

 

 

  • December 01, 2011
  • Like
  • 0

Can we get a proper log without any limitations? I have a batch that works fine when the record count is low but fails at high counts. In the latter case I cannot see what the error was because the debug log cuts off somewhere in the middle. Up until now I have been dealing with this just by making guesses and trial and error changes but I really don't think I should be doing that!! :)

 

Is it possible to see what the error was? Thanks.

  • December 16, 2009
  • Like
  • 1