• Nick Whitney
  • NEWBIE
  • 30 Points
  • Member since 2013
  • Appirio


  • Chatter
    Feed
  • 1
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 4
    Replies
I am trying to figure out how to pass the ID of an existing record I am trying to update. I get the above error in the debug logs after running this method.

As a background, I have a trigger after update running the passes trigger.new into a method called MarqueeUpdate. From there, I query to find the existing ChangeRecord__c. I need the ID of that ChangeRecord__c to update. 

I cannot figure out how to pass the id of that record to my update statement. 
//Updating existing records
    public static void MarqueeUpdate(List<NI_MarqueeFeature__c> marqueeUpdate){ 
        
        //marqueeUpdate contains trigger.new
        for (NI_MarqueeFeature__c mi : marqueeUpdate){
            String Id = mi.Id;
            List <ChangeRecord__c>  upMarquee = [SELECT ID
                    				 FROM ChangeRecord__c
                				 WHERE ChangeRecord__c.ID__c = :Id];
            
                    if (marqueeUpdate.size()>0) {
                        ChangeRecord__c um = new ChangeRecord__c ();
                        
                        um.ID__c = mi.id;
                        um.LastMod__c = mi.LastModifiedDate;
                        
                        upMarquee.add(um);
                        
                        try {
                            update um;
                          } catch (system.DmlException e) {
                            system.debug (e);}
        }
        }
    }

I am trying to figure out how to pass the ID of an existing record I am trying to update. I get the above error in the debug logs after running this method.

As a background, I have a trigger after update running the passes trigger.new into a method called MarqueeUpdate. From there, I query to find the existing ChangeRecord__c. I need the ID of that ChangeRecord__c to update. 

I cannot figure out how to pass the id of that record to my update statement. 
//Updating existing records
    public static void MarqueeUpdate(List<NI_MarqueeFeature__c> marqueeUpdate){ 
        
        //marqueeUpdate contains trigger.new
        for (NI_MarqueeFeature__c mi : marqueeUpdate){
            String Id = mi.Id;
            List <ChangeRecord__c>  upMarquee = [SELECT ID
                    				 FROM ChangeRecord__c
                				 WHERE ChangeRecord__c.ID__c = :Id];
            
                    if (marqueeUpdate.size()>0) {
                        ChangeRecord__c um = new ChangeRecord__c ();
                        
                        um.ID__c = mi.id;
                        um.LastMod__c = mi.LastModifiedDate;
                        
                        upMarquee.add(um);
                        
                        try {
                            update um;
                          } catch (system.DmlException e) {
                            system.debug (e);}
        }
        }
    }

Hi,

 

I have a VF page with a jQuery input field (actually a timepicker).

 

1) The NOK user scenario is the following : the user deletes the content of the input field and click immediately on the (VF) Save button.  VF has to process 2 events : - updating the field in the data model (jQuery event), and saving the data model to the database (Visualforce-managed event).

Unfortunately, the Save event does not 'wait' for the update to take place : the saved data is not up to date.

 

2) The OK scenario is the following : the user deletes the content of the input field and click somewhere else in the page, then clicks on the Save button. The data is always correctly saved to the database.

 

How can I make sure, in scenario 1) that the data gets updated before being saved ?

Thanks for any help,

Rup