• cmaine3
  • NEWBIE
  • 0 Points
  • Member since 2009

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 6
    Questions
  • 6
    Replies

Hi everyone,

 

So I have a trigger that is workin ggreat in the test environment and I thought I could just bang out the test class and get it over. Well, I can't seem to write test code I guess. Can anyone advise?

 

Trigger-

trigger update30DayNoticeSentOnTaskComplete on Task (after update) {
public Id oppId;
for(Task t:Trigger.New){
if(t.WhatId != NULL)
if(t.Subject=='Send Out Notice To Vacate')
if(t.Status=='Completed'){
oppId = t.WhatId;
}
}
List<Opportunity> opp = [select Id from Opportunity where id = :oppId];
for(Opportunity o : opp){
o.X30_Day_Letter_Sent__c = system.today()+5;
update o;
}

}

 

 

Hi There!

 

I have a need to update a date field on an opportunity when the task status is changed to completed.Workflow as follows:

 

Task marked "Completed" > Field "Follow up date" = TODAY() + 5

 

Pretty simple, but I will be using this trigger as framework for other triggers to get all our reps in line to follow through with a process, so it's pretty important. Thanks anyone who's willing to help.

 

 

Hi there-

 

So I got assistance on this code, built the test class and deployed it. It works fine when creating a Task under Opp but throws a null pointer exception error when I create a task under any other object.

 

Goal: When adding a task in opportunity automatically pull the assigned rep and select the picklist field for them on the task. When no rep selected do nothing.

 

Both fields are named Assigned_Rep__c, however the field on the Opp is a reference Assigned_Rep__r.Name. I do not need any trigger except when accessed from an opportunity.

 

Error:

 

Attempt to de-reference a null object Trigger.populatePicklist: line 9, column 34

 Trigger

trigger populateAssignedRep on Task(before insert, before update){
    
    
    String oppPrefix = Schema.SObjectType.Opportunity.getKeyPrefix();
    List<Id> oppIds = new List<Id>();
    
    for(Task t: Trigger.new){
        String relatedTo = (String)t.WhatId;
        String relatedToPrefix = relatedTo.subString(0,3);
        if(oppPrefix == relatedToPrefix){
           oppIds.add(t.WhatId);
        }
    }
    
    Map<Id,Opportunity> oppMap = new Map<Id,Opportunity>();
    if(!oppIds.isEmpty()){
        oppMap.putAll([Select Id, Name, Assigned_Rep__c, Assigned_Rep__r.Name from Opportunity where Id IN :oppIds]);
        
    
          for(Task t: trigger.new){
             String relatedTo = (String)t.WhatId;
             String relatedToPrefix = relatedTo.subString(0,3);
             if(oppPrefix == relatedToPrefix){
                if(oppMap.containsKey(t.WhatId)){
                   Opportunity opp = oppMap.get(t.WhatId);
                   if(opp.Assigned_Rep__c != null){
                      t.ARI_Rep__c = opp.Assigned_Rep__r.Name;                    }
                }
             }
          }
    }
}

 

I'm using this as my first venture into triggers, and was able to handle the test class by myself, so I am extremely appreciative of the help I am getting. Thanks everyone.

 

  • September 09, 2010
  • Like
  • 0

Hello everyone-

This should be a quick slam dunk for any trigger masters out there and should help me to start learning myself.

 

Goal-

When a task is added to an Opportunity the lookup field Rep_Team__c on the opportunity record is checked. If the field is populated then it will take that value and convert it to the corresponding task record picklist value Rep_Tm__c.

 

This is 1:1 conversion or nothing. (meaning if the picklist value is not available then it will be left alone.)

 

I really wish I could give more information than this but I don't understand the syntax and am hoping that by seeing the working code I can learn to create my own.

 

Thanks for any help!!

 

 

 

 

 

  • September 08, 2010
  • Like
  • 0

I've come across a need to add notes to opportunities but without the steps of going into the notes section and adding a header. My Opp detail screen is already in Visualforce but I'm wondering if there's anything I'm overlooking before I develop it. Any code samples would also be appreciated. 

 

Also- anyone know where I can find visualforce representations of standard pages?

 

 

Mock up of what I'm planning-- Thanks!

 


OBJECTIVE


Employ abilities in business systems and analysis to create effective solutions capable of solving short-term needs that will apply towards long-term requirements. Developing streamlined solutions in terms of creation, delivery, maintainability, and scalability, while minimizing financial outlay through leadership. Strengths include recognition of system interrelations, mastery use of several software packages and operating systems, and novel problem-solving to improve functionality.

SKILLS & ATTRIBUTES


• Salesforce.com Administration and Development

• Microsoft SharePoint

• Microsoft Project

• Microsoft Office Suite

• QuickBooks

• ProModel & ServiceModel

Business Modeling Software

• A/R, A/P, & Payroll Experience

• Strong Customer Relations Skills

• KnowledgeBase Administration

• HTML Editing and Development

WORK EXPERIENCE


Project Coordinator
Granicus, Inc.
( April 2008 – May 2009 ) San Francisco, CA

• Planned, administered and launched new initiatives to a cross team environment including associated presentations and meetings

• Handled all aspects of new projects from creation of vision scope through all phases of design, development, procurement, implementation and deployment.

• Administered and developed Salesforce.com integration solutions for a highly technical company with over 100 employees

Project Coordinator
Parsons Corporation
( September 2007 – April 2008 ) San Francisco, CA

• Created a Microsoft SharePoint Collaboration Portal for use between the Client, Coworkers, and Administrative Staff to work on Project Sites and Finances

• Provided Planning support including performing Zoning and Building Submittals

• Performed as interim Project Manager in interaction and decision facility

Wireless Services Specialist
Delta Business Services
( June 1999 – July 2002 ) Sacramento, CA/Las Vegas, NV

• Directed repair procedures and schedules as the Certified Lead Repair Technician for the Nextel Motorola units

• Designed and implemented a Repair Department that processed an average of 280 units a month to four different carriers

• Intermediated between Corporate and Government Special Accounts and Wireless Providers in services of Bill Analysis, Funds Recovery, and Batch Sales

EDUCATION


Certificate Specialization Program
UC Berkeley Extension
(March 2008 – May 2008)

• Project Management Extension: Project Management, Project Scheduling, and Control Management

Bachelor of Science
San Jose State University
( September 2004 – August 2006 )
City University of Hong Kong ( August 2006 – December 2006 )

• Business Administration: Concentration in Management

• Emphasis in Data Analysis, Computer Science, and International Business

Associate in Arts- Liberal Arts
Associate in Arts- Social Science
American River College
( June 1999 – August 2004 )

• Liberal Arts: Concentration in Humanities and Learning Skills

• Social Science: Concentration in Political Science and US History


ORGANIZATIONS & ACTIVITIES


Active Member
Project Management Institute (PMI) ( 2007 - Present)

Director of Finance
Student Government Association
( February 2004 - September 2004 )

• Chaired the Student Government Finance Committee

• Managed staff work hours for Campus Arcade and Print Shop



Please see my Linkedin profile for more details on my job history and professional associations here:

http://www.linkedin.com/in/chrismaine



Message Edited by cmaine3 on 05-05-2009 10:21 PM

Hi everyone,

 

So I have a trigger that is workin ggreat in the test environment and I thought I could just bang out the test class and get it over. Well, I can't seem to write test code I guess. Can anyone advise?

 

Trigger-

trigger update30DayNoticeSentOnTaskComplete on Task (after update) {
public Id oppId;
for(Task t:Trigger.New){
if(t.WhatId != NULL)
if(t.Subject=='Send Out Notice To Vacate')
if(t.Status=='Completed'){
oppId = t.WhatId;
}
}
List<Opportunity> opp = [select Id from Opportunity where id = :oppId];
for(Opportunity o : opp){
o.X30_Day_Letter_Sent__c = system.today()+5;
update o;
}

}

 

 

Hi There!

 

I have a need to update a date field on an opportunity when the task status is changed to completed.Workflow as follows:

 

Task marked "Completed" > Field "Follow up date" = TODAY() + 5

 

Pretty simple, but I will be using this trigger as framework for other triggers to get all our reps in line to follow through with a process, so it's pretty important. Thanks anyone who's willing to help.

 

 

Hi there-

 

So I got assistance on this code, built the test class and deployed it. It works fine when creating a Task under Opp but throws a null pointer exception error when I create a task under any other object.

 

Goal: When adding a task in opportunity automatically pull the assigned rep and select the picklist field for them on the task. When no rep selected do nothing.

 

Both fields are named Assigned_Rep__c, however the field on the Opp is a reference Assigned_Rep__r.Name. I do not need any trigger except when accessed from an opportunity.

 

Error:

 

Attempt to de-reference a null object Trigger.populatePicklist: line 9, column 34

 Trigger

trigger populateAssignedRep on Task(before insert, before update){
    
    
    String oppPrefix = Schema.SObjectType.Opportunity.getKeyPrefix();
    List<Id> oppIds = new List<Id>();
    
    for(Task t: Trigger.new){
        String relatedTo = (String)t.WhatId;
        String relatedToPrefix = relatedTo.subString(0,3);
        if(oppPrefix == relatedToPrefix){
           oppIds.add(t.WhatId);
        }
    }
    
    Map<Id,Opportunity> oppMap = new Map<Id,Opportunity>();
    if(!oppIds.isEmpty()){
        oppMap.putAll([Select Id, Name, Assigned_Rep__c, Assigned_Rep__r.Name from Opportunity where Id IN :oppIds]);
        
    
          for(Task t: trigger.new){
             String relatedTo = (String)t.WhatId;
             String relatedToPrefix = relatedTo.subString(0,3);
             if(oppPrefix == relatedToPrefix){
                if(oppMap.containsKey(t.WhatId)){
                   Opportunity opp = oppMap.get(t.WhatId);
                   if(opp.Assigned_Rep__c != null){
                      t.ARI_Rep__c = opp.Assigned_Rep__r.Name;                    }
                }
             }
          }
    }
}

 

I'm using this as my first venture into triggers, and was able to handle the test class by myself, so I am extremely appreciative of the help I am getting. Thanks everyone.

 

  • September 09, 2010
  • Like
  • 0

Hello everyone-

This should be a quick slam dunk for any trigger masters out there and should help me to start learning myself.

 

Goal-

When a task is added to an Opportunity the lookup field Rep_Team__c on the opportunity record is checked. If the field is populated then it will take that value and convert it to the corresponding task record picklist value Rep_Tm__c.

 

This is 1:1 conversion or nothing. (meaning if the picklist value is not available then it will be left alone.)

 

I really wish I could give more information than this but I don't understand the syntax and am hoping that by seeing the working code I can learn to create my own.

 

Thanks for any help!!

 

 

 

 

 

  • September 08, 2010
  • Like
  • 0

Hi All,
     I wish to associate a custom tab view to a visualforce page , is it possible if so kindly guide me with the  appropriate steps.


Thanks in Advance
Regards
Nalini

Message Edited by Nalini on 06-03-2009 12:18 AM
Message Edited by Nalini on 06-03-2009 03:50 AM
Message Edited by Nalini on 06-03-2009 03:52 AM