• Vlad Olano
  • 0 Points
  • Member since 2011

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



I'm new to this, sorry if this has already been covered but I'm getting very dismayed by this not working.


What I need to do is have an action associated with a selection from my selectList on my VF page that will go off and use the selectedOption as an Id in a query.


For example the selectList has a list of accounts (Sites) and I want the user to select an account, fire the action that will then display that account on screen to the user.


I just keep getting the "System.DmlException: Update failed. First exception on row 0; first error: MISSING_ARGUMENT, Id not specified in an update call: [] "


error message.


Here is the code from the VF page



<apex:selectList id="sites"  size="1" title="Manager">
                        <apex:selectOptions value="{!ClientSites}"></apex:selectOptions>
                        <apex:actionSupport event="onchange" action="{!saveCalendars}">
                        <apex:param name="site" value="{!theSite}" assignTo="{!theSite}" />



And here is the code I'm trying to get to work...


public Id theSite {get; set;}
    public PageReference saveCalendars()
        theSite = ApexPages.currentPage().getParameters().get('site');
        Client_Site__c siteToUpdate =
        new Client_Site__c(Id = theSite);
        System.debug('This is the ID : ' + theSite);
        update siteToUpdate;
        return null;

I really hope someone can help me with tis. Just cannot see why it won't work? The onlty thing I can think of is a timing thing with rendering etc.


Does anyone have suggestions on how I can fix this please?


Thanks in advance,