• pvande
  • NEWBIE
  • 40 Points
  • Member since 2012

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 12
    Questions
  • 8
    Replies
Hi Guys,

I have a requirement ..i  need to create a visualforce page which will display all account names in custom picklist.
Please help me on this.

Thanks in Advance.
Smitha
I am new to Apex trigger/class coding.  I was able to create a simple trigger that works, but I am having trouble with code coverage and can't roll it to the production environment.  I would appreciate any help with Apex Class coding.  (or could you point me toward a tutorial?) Thank you in advance.

My trigger is as follows:

trigger WorkstreamStamp on Project__c (before insert) {
    For(Project__c p : Trigger.New)
    {
         If(p.Workstream__c == null)
         {
           List<Account> incomingprojinfo = [Select Workstream__c FROM  Account WHERE Id =:p.Sponsor_Account_Ultimate_Parent__c LIMIT 1];
                               {
               p.Workstream__c = incomingprojinfo[0].Workstream__c;
           }                                                      
          
         }
       
    }                           
}
Please help me add a line of code to my trigger.  I don't want the trigger to run if Date_Pushed_to_Production__c is populated.  This field resides on the custom object Project__c.  Thank you for looking at my question.  
Here is the trigger:


Trigger MoveToProduction on Opportunity (before insert, before update){

   List<ID> ProjIds = New List<ID>();

  for(Opportunity o : Trigger.new){
    if(o.Move_to_Production__c == true && o.RecordTypeId == '012a0000001FqTn'){
    
      ProjIds.add(o.Project__c);
  }

  List<Project__c> ProjList = [SELECT id, Move_to_ProductionP__c, Date_Pushed_to_Production__c FROM Project__c WHERE id in :ProjIds];
  for(integer i = 0 ; i < ProjList.size(); i++){
    If(ProjList[i].Date_Pushed_to_Production__c == null)
     
     ProjList[i].Move_to_ProductionP__c = true;
       ProjList[i]. Date_Pushed_to_Production__c = system.today();
      
  update ProjList;
I am new to APEX coding and am struggling with the following error.  Any help would be apprecaited.
Error: Compile Error: Variable does not exist: Designated_Forecast_Account__c at line 5 column 1

My trigger:

trigger ForecastAccount on Opportunity (before insert, before update) {
 
if ( Project__r.Sponsor_Account__r.Forecast_Account__c  = True) {
 
Designated_Forecast_Account__c =  Sponsor_Account__r.Id ;
 
} else if
 
(  Project__r.Sponsor_Account__r.Forecast_Account__c  = False){
 
Designated_Forecast_Account__c = Sponsor_Account__r.Reporting_Parent__c ;
 }
}
 
Hi - I am trying to create a custom Save button for the CASE object.  I would like standard save functionality along with this code so that the case will synchronize with JIRA.  Could I please have help with the code?

https://jira-dev.int.helloworld.com/plugins/servlet/customware/connector/issue/7/Case/synchronize.action?id={!Case.Id}
 
My trigger is too agressive and I am hoping that you can help.

Goal:  Update the boolean Move_to_ProductionP__c (on Project__c) if the following criteria are true:  o.Move_to_Production__c = True and o.RecordTypeId == '012a0000001FqTn'
Problem:  The trigger updates the boolean field Move_to_Production__c on the custom Project object (this is desired)  but it also updates the boolean field on  the Opportunity field Move_to_Production__c as True upon creation of an opportunity, which is not a desired outcome.

Here is my code.  I would appreciate any help from the experts!  Thanks in advance for looking.

trigger MoveToProduction on Opportunity (before insert, before update) {   

List<ID> ProjIds = New List<ID>();   

for(Opportunity o : Trigger.new){
 if(o.Move_to_Production__c = true && o.RecordTypeId == '012a0000001FqTn')
{       ProjIds.add(o.Project__c);    
 }
  }   
List<Project__c> ProjList = [SELECT id, Move_to_ProductionP__c FROM Project__c WHERE id in :ProjIds];   for(integer i = 0 ; i < ProjList.size(); i++){     
ProjList[i].Move_to_ProductionP__c = true;     
  }
update ProjList;
}
 

I AM RECEIVING THIS ERROR MESSAGE:

 

 

Failure Message: "System.DmlException: Insert failed. First exception on row 0; first error: INACTIVE_OWNER_OR_USER, operation performed with inactive user: []", Failure Stack Trace: "Class.TestEventDivisionUpdate.testEventDivisionUpdate: line 13, column 1"

 

WHEN I DEPLOY AN UPDATE TO AN EXISTING TRIGGER USING THIS CLASS:

CAN SOMEONE PLEASE HELP ME UNDERSTAND WHY I WOULD GET A "FAILURE STACK TRACE"?  THANK YOU!

 

@isTest
private class TestEventDivisionUpdate {
//This test will also test the Account and Contact Trigger

    static testMethod void testEventDivisionUpdate() {
        
        // Create a User, an Account and a Contact for testing purposes
       
        User u = [SELECT Id, Division, Department from User
            WHERE Division <> null AND Department <> null LIMIT 1];
            
        Account a = new Account(Name = 'Test Account', OwnerId=u.Id);
        insert a;  
        Contact c = new Contact(LastName='Test', AccountId=a.Id, OwnerId=u.Id);
        insert c;
        
        datetime StartDate = datetime.newInstance (2011, 5, 27);
        datetime EndDate = StartDate.addDays(2);
        
        Event e = new Event(Subject = 'TestSubject', OwnerId=u.Id, WhoId = c.Id, StartDateTime = StartDate, EndDateTime=EndDate);
        insert e;    
      
        Event updatedE = [SELECT Id, Department__c
            FROM Event WHERE Id = :e.Id LIMIT 1];
        
        Account UpdatedA = [SELECT Id, Department__c
            FROM Account WHERE Id = :a.Id LIMIT 1];
            
            Contact UpdatedC = [SELECT Id, ePrize_Department__c
            FROM Contact WHERE Id = :c.Id LIMIT 1];
            
        // Now do the assertions
    //    System.assertEquals(updatedE.Department__c, u.Department);
      //  System.assertEquals(updatedA.Department__c, u.Department);
        // System.assertEquals(updatedC.ePrize_Department__c, u.Department);