• James Kinsey
  • NEWBIE
  • 0 Points
  • Member since 2010

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

So I am curious, has anybody implemented a "Like" button for use with their Chatter??

Same idea as Facebook where you can "like" somebody's feed post. 

 

Please share if so :) It would be interesting to see how too...

 

- JK

Is this the correct extension to get the custom object "equipment__c" data and create a new opportunity with fields already populated with equipment__c values? Either this isn't right or I'm referencing it wrong from the visualforce page.

 

public without sharing class OppClass2
{

    private final equipment__c equipment;
    
      public OppClass2(ApexPages.StandardController opportunity) {
            }
      public oppclass2() {
        equipment = [select id, name from Equipment__c
        where id = :ApexPages.currentPage().getParameters().get('id')];
          }
          
      public Equipment__c getequipment() {
          return equipment;  
          }

    public PageReference NewOpp(){
        Opportunity o = new Opportunity(name = equipment.name,StageName='New Opportunity',CloseDate=system.today());
        Database.SaveResult[] lsr = Database.insert(new Opportunity[]{o, new Opportunity(name = equipment.name,StageName='New Opportunity',CloseDate=system.today())},false);
        for(Database.SaveResult sr: lsr){
            if(!sr.isSuccess())
                Database.Error err = sr.getErrors()[0];
        }
                return (new ApexPages.StandardController(o)).edit();

        }

}

 

Hello,

 

I am new and seeking out how to code a VF page to insert a new opportunity and show this new opportunity in the edit mode before inserting (saving).

 

Thanks,

 

- James -

Hello - I am writing a simple trigger to copy an auto-formula field text into the standard field of my custome object.  I have this error of...

Compile Error: Illegal assignment from LIST<Equipment__c> to LIST<Name> at line 2 column 9

 

My code is:

trigger AutoEName on Equipment__c (before insert, after update) {   
        List<name> NametoUpdate =
        [SELECT e.name
         FROM Equipment__c e
          For Update];
            
        For (Name n: NametoUpdate) {
             n == equipment__c.Auto_Name__c;               }
               
           update NametoUpdate;     
    }

 

Any help would be great.  Thanks!

Hello,

 

I am trying to create a custom button on a custom object to create an opportunity. I would like to merge many fields from the custom object into the new opportunity to reduce admin data entry.

 

Does anybody have a good example of their code that I can view and use as an example to base my developement around?

 

Thanks in advance!!!

 

- James

 Hello,

 

I am very new to APEX trigger writing and I am having this error.

 

My intention:

Basically when a user enters a new flight hours on the custom object Flight_Hours__c, and when the user also selects a checkbox called Update_Equipment_Last_Hours__c, that the trigger then references the related Equipment__c and updates that Equipments last hours.

 

My code:

trigger UpdateLastHours on Flight_Hours__c (after insert) {

 

for (Flight_Hours__c j : trigger.new)
    {
        If (j.Update_Equipment_Last_Hours__c = True)
        {
            j.Hours__c = j.Equipment__r.LastHours__c;
            j.Hours_Date__c = j.Equipment__r.LastHoursDate__c;
        }

    }

}

 

My error:

 Error: Invalid Data.
Review all error messages below to correct your data.
Apex trigger UpdateLastHours caused an unexpected exception, contact your administrator: UpdateLastHours: execution of AfterInsert caused by: System.FinalException: Record is read-only: Trigger.UpdateLastHours: line 7, column 13

 

Any help would be greatful, and please excuse the noob if this is super simple :)

 

Thanks,

 

James

So I am curious, has anybody implemented a "Like" button for use with their Chatter??

Same idea as Facebook where you can "like" somebody's feed post. 

 

Please share if so :) It would be interesting to see how too...

 

- JK

Is this the correct extension to get the custom object "equipment__c" data and create a new opportunity with fields already populated with equipment__c values? Either this isn't right or I'm referencing it wrong from the visualforce page.

 

public without sharing class OppClass2
{

    private final equipment__c equipment;
    
      public OppClass2(ApexPages.StandardController opportunity) {
            }
      public oppclass2() {
        equipment = [select id, name from Equipment__c
        where id = :ApexPages.currentPage().getParameters().get('id')];
          }
          
      public Equipment__c getequipment() {
          return equipment;  
          }

    public PageReference NewOpp(){
        Opportunity o = new Opportunity(name = equipment.name,StageName='New Opportunity',CloseDate=system.today());
        Database.SaveResult[] lsr = Database.insert(new Opportunity[]{o, new Opportunity(name = equipment.name,StageName='New Opportunity',CloseDate=system.today())},false);
        for(Database.SaveResult sr: lsr){
            if(!sr.isSuccess())
                Database.Error err = sr.getErrors()[0];
        }
                return (new ApexPages.StandardController(o)).edit();

        }

}

 

Hello,

 

I am new and seeking out how to code a VF page to insert a new opportunity and show this new opportunity in the edit mode before inserting (saving).

 

Thanks,

 

- James -

Hello - I am writing a simple trigger to copy an auto-formula field text into the standard field of my custome object.  I have this error of...

Compile Error: Illegal assignment from LIST<Equipment__c> to LIST<Name> at line 2 column 9

 

My code is:

trigger AutoEName on Equipment__c (before insert, after update) {   
        List<name> NametoUpdate =
        [SELECT e.name
         FROM Equipment__c e
          For Update];
            
        For (Name n: NametoUpdate) {
             n == equipment__c.Auto_Name__c;               }
               
           update NametoUpdate;     
    }

 

Any help would be great.  Thanks!

Hello,

 

I am trying to create a custom button on a custom object to create an opportunity. I would like to merge many fields from the custom object into the new opportunity to reduce admin data entry.

 

Does anybody have a good example of their code that I can view and use as an example to base my developement around?

 

Thanks in advance!!!

 

- James

 Hello,

 

I am very new to APEX trigger writing and I am having this error.

 

My intention:

Basically when a user enters a new flight hours on the custom object Flight_Hours__c, and when the user also selects a checkbox called Update_Equipment_Last_Hours__c, that the trigger then references the related Equipment__c and updates that Equipments last hours.

 

My code:

trigger UpdateLastHours on Flight_Hours__c (after insert) {

 

for (Flight_Hours__c j : trigger.new)
    {
        If (j.Update_Equipment_Last_Hours__c = True)
        {
            j.Hours__c = j.Equipment__r.LastHours__c;
            j.Hours_Date__c = j.Equipment__r.LastHoursDate__c;
        }

    }

}

 

My error:

 Error: Invalid Data.
Review all error messages below to correct your data.
Apex trigger UpdateLastHours caused an unexpected exception, contact your administrator: UpdateLastHours: execution of AfterInsert caused by: System.FinalException: Record is read-only: Trigger.UpdateLastHours: line 7, column 13

 

Any help would be greatful, and please excuse the noob if this is super simple :)

 

Thanks,

 

James

I have a custom object called Inventory that is tied to the Opportunity object. On the inventory object I have a custom button that creates a new inventory record and copies the opportunity name, picks the appropriate record type, etc.

 

The problem I am having is putting this button that is on the inventory object onto the inventory related list section on the opportunity page layout, only a New button is available. Is this a limitation?

 

I would not even need to do this if the button would show up on our users blackerry's at the top of the opportunity page layout, which is where the button originally was before I moved it to the inventory object,

  • November 17, 2010
  • Like
  • 0