• Nzgon
  • 125 Points
  • Member since 2011
  • Software Architect and Developer
  • Algonquin College

  • Chatter
  • 5
    Best Answers
  • 0
    Likes Received
  • 1
    Likes Given
  • 0
  • 35

Hi Guys,


I have requirement, I need to create a view on Contact  within the past two hours of the current time .


I think this cannot be done using  based on currentdate, because our call center is open 24 hours. so If a Contact is created at 11pm on tuesday then the view would display the record up untill 1 am on wednesday.


can any one suggest me on this how to create the viwe according to my requirement.


is it possible or not.



Thank you


  • October 28, 2011
  • Like
  • 0

hello i have a problem with cookies.

is there any way to check that this particular cookie exists or not ?

how can i check that ?

any kind of help will be appriciated.

Thanks in advance......

I have a batch process that sends a case summary report to a special set of clients. Because the report is rather complicated - open cases, closed cases, pending cases with links to the self-service portal - , and each  company has several people who receive the report, I execute the report via a batch job that processes each company as a separate batch. This works fine as no company has more than 10 recipients, and each batch stays under the 10 sendEmail limit.


But when I try to run the same via Scheduled Apex, it stops as soon as the total number of emails in all batches reaches the 10-email limit.


Why is the limit processed differently when the process is kicked off manually and when the process is kicked off as scheduled Apex?


Any help would be greatly appreciated.

Hello.  I was wondering if anyone could give me some guidance with the below.


A commandLink invokes the below controller code.  The goal with the below code is to advance to a new page (MyPage)...and populate this page with a specific record's data (based on the value of the below 'myRecordId').


In addition to populating the page with the data from the 'myRecordId' record, I also want to add a message to the top of the page (based on the value of a variable computed by the controller).


I have been able to easily do this on other pages.  However, this time, my problem is that I cannot get my message to render on the page.  While I usually simply add my code immediately below the "public PageReference GoToPage" line, I think my use of the 'setredirect' code is causing some problems.


Thanks in advance for any guidance.  I will be glad to explain further if this does not make complete sense.


public PageReference GoToPage() {
PageReference aaaa = new PageReference('/apex/MyPage?id=' + myRecordId);
// The below code is intended to set a variable 'statusmessage' based on the 'salestotal' value.
// Unfortunately, the 'statusmessage' is not rendering on the page
// I think the 'setredirect' code is somehow preventing the below to exexute properly.
statusmessage = 'sales today are acceptable';
statusmessage = 'sales today are unacceptable';
return aaaa;


Copy Opportunity and Opportunity products into a New Invoice with Invoice Line Items By clicking a button on Opportunity a new invoice should be created with Line Items. The data should be populated from opportunity and opportunity Product(Lines).
  • October 13, 2011
  • Like
  • 0

Spinning my wheels on this.  I'm not an APEX coder but this problem is within my skill set.


I am trying to check to see if "Account_Record__c" on "Lead" is null - and then insert a record if it is.  No errors when I save the code, but when I test none of the records are behaving as expected!  In my test records there are no values in "Account_Record__c" yet the related object record is not created.  If I remove the "&& newLead.Account_Record__c==null" element then the related record is created.


What am I missing?



trigger createSalesAssignment on Lead (after update) {     
List<Sales_Assignment__c> sa = new List<Sales_Assignment__c>();
    for (Lead newLead: Trigger.New)
         if (newLead.Status == 'Sales Ready' && newLead.Account_Record__c==null){
                 sa.add (new Sales_Assignment__c(
                     Lead__c = newLead.Id));   
   insert sa;





Hi All,


let me know difference b/w what id and who id?



I need to add community members of a community to the campaign members list.

I tried querying in my own way but i cound not execute successfully.


this was the error it was giving


Insert failed. First exception on row 0; first error: REQUIRED_FIELD_MISSING, Attempted to add a campaign member where either the member id 'null' or the campaign id 'null' is null.: []


I was not sure what is member id whether it is a contact id or community id or any other fields are missing..


I appreciate any help on this.



  • November 04, 2011
  • Like
  • 0



I am new to salesforce and needed some help regarding passing records using checkbox to next VF page...

I have created a custom object with some text fields and i have created a VF page in which i have displayed these fields along with a checkbox.Its somewhat like a checkbox in a datatable kind of look.

Also i have created a wrapper class that holds the selected(checked) records.Now i want these checked records to be retrieved and displayed in the next VF page on passing it as a url parameter in page reference.

How is this done? Is there any other way of doing this apart from passing it as a url parameter.

Please help...



  • November 04, 2011
  • Like
  • 0

I have a VF page with the Opportunity as the standard controller.  Within this page I have referenced the related Account with some input fields.  You can see this below in a small snippet I took:


................<apex:inputField Value="{!Opportunity.Reason_Won__c}" required="true" />
                <apex:inputField Value="{!Opportunity.Sale_Notes__c}"  style="width:125pt; height:50pt"/>
            <apex:pageblocksection showHeader="true" columns="2" title="2 - Account Info" rendered="{!if(Opportunity.Amount=0, false, true)}">
                <apex:inputField Value="{!Opportunity.LeadSource}"  required="true"/>
 	 <apex:inputField Value="{!Opportunity.Account.Industry}" required="true" /> .................



The whole idea here is to allow my users to perform an operation that requires them to populate fields under the Account and Opportunity.  Unfortunately, what happens when they save the page is it only updates the Opportunity fields while disregarding any changes made to the Account fields.  In otherworsd, I may have selected "Fitness" for the Account.Industry inputField.  However, upon saving the page the Industry field is left blank under the Account.  Is this by design?  If so, how would I manipulate it with APEX to allow me to pass these changes to the Account?

Hi Guys,


I have requirement, I need to create a view on Contact  within the past two hours of the current time .


I think this cannot be done using  based on currentdate, because our call center is open 24 hours. so If a Contact is created at 11pm on tuesday then the view would display the record up untill 1 am on wednesday.


can any one suggest me on this how to create the viwe according to my requirement.


is it possible or not.



Thank you


  • October 28, 2011
  • Like
  • 0

assign the account if contact is created with out account if account name is abc ,

i created the trigger , but i account abc is deleted , so how can i manage that .

i want to put a rule that , if contact is created without account , then the contacts aaccount is 'abc'.

if abc is deleted then no account is assigned to that contacts.  

I have created a trigger that creates a Contact called "Accunt Email" if a new Account is created and a custom field called "Company Email" is populated with an email address.


I have trigger working on "after insert" but when I try to add "after update" it duplicates the contact record. I'm not sure how to include the "after update" without creating duplicte contacts or how update the email address on the Contact record if the email address on the Account page is modified.




trigger CompanyEmail on Account (after insert, after update) {

  List<Contact> ct = new List <Contact>();
    for (Account newAccount: Trigger.New){
        if (newAccount.Company_Email__c != null){
                 ct.add (new Contact(
                     FirstName = 'Account',
                     LastName = 'Email',
                     Email = newAccount.Company_Email__c,
                     AccountId = newAccount.id,
                     OwnerId = '00530000001jaC1'));   
 insert ct;  
      if (Trigger.isUpdate) {
        List<Contact> cnt = [SELECT id FROM Contact WHERE Firstname = 'Account'];
       for(Account olduAccount : trigger.old){
              cnt.add (new Contact(
                    Email = olduAccount.Company_Email__c));
    update cnt;


  • October 26, 2011
  • Like
  • 0

Hi there,


Does anyone know a way to build a visual force page that will display locations on a google map from account list views?


For example, when my accounts is chosen from accounts view, I would like to be able to see all of those locations mapped.


It can be a separate tab, or embedded somehow on the list view page.


I'm no expert but I'm learning :)





Looking to recreate the buttons on the page layouts to my custom Visual Force page. How do you find the Methods in the objects standard controllers?

  • October 21, 2011
  • Like
  • 0

I have a test Visualforce app published on Sites in my developer org. One of the pages has a lookup field which should pop up a standard LookupPage (when the spyglass icon is clicked), but the LookupPage states that authorisation is required as if I have to explicitly specify public access settings for it in Sites.


Is this the case? If so how do I give it public access settings given its not in my 'Available Visualforce Pages' list?


I am using TDTM framework for my projects. I have created a triggerhandler record with my class name configured for delete. When I try deleting a record in synchronous mode it is successful. When I try deleting a record in TDTM framework in Asynchronous mode I am getting below error.

first error: CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY, hed.TDTM_CourseEnrollment: execution of AfterDelete caused by: System.NullPointerException: Attempt to de-reference a null object Class.hed.TDTM_TriggerHandler.runAsync: line 162, column 1 Class.hed.TDTM_TriggerHandler.runClass: line 135, column 1 Class.hed.TDTM_TriggerHandler.run: line 75, column 1 Class.hed.TDTM_Global_API.run: line 61, column 1 Trigger.hed.TDTM_CourseEnrollment: line 33, column 1: []

The code base is in

And the error is occuring as in delete it is trying to access newList.

Is there any alternative that I can use after delete in Async mode?