how often does the letter "u" occur in:
q: update lastmodifieddate field of custom object i'm uploading attachments to a custom object using the following js.
i want to update the lastmodifieddate field of the custom object each time i do this.
would anyone have any suggestions as to how i might accomplish this?
my initial attempt in the onsuccess function below does not work...  
function uploadfile(customobj)
{       
var input = document.getelementbyid('file-input');
var parentid = customobj.id

var filestoupload = input.files;

for(var i = 0, f; f = filestoupload[i]; i++)
{
    var reader = new filereader();     

    // keep a reference to the file in the filereader so it can be accessed in callbacks
    reader.file = f; 

    reader.onerror = function(e) 
    {
        switch(e.target.error.code) 
        {
            case e.target.error.not_found_err:
                alert('file not found!');
                break;
            case e.target.error.not_readable_err:
                alert('file is not readable');
                break;
            case e.target.error.abort_err:
                break; // noop
            default:
                alert('an error occurred reading this file.');
        };
    };     

    reader.onabort = function(e) 
    {
        alert('file read cancelled');
    };

    reader.onload = function(e) 
    {
        var att = new sforce.sobject("attachment");
        att.name = this.file.name;
        att.contenttype = this.file.type;
        att.parentid = parentid;

        att.body = (new sforce.base64binary(e.target.result)).tostring();

        sforce.connection.create([att],
        {
            onsuccess : function(result, source) 
            {
                if (result[0].getboolean("success")) 
                {
                  var test_date = customobj;              <-- possible solution?
                  test_date.lastmodifieddate = new date();<-- possible solution?                     
                  sforce.connection.update([test_date ]); <-- possible solution?  

                   console.log("new attachment created with id " + result[0].id);
                } 
                else 
                {
                    console.log("failed to create attachment " + result[0]);
                }
            }, 
            onfailure : function(error, source) 
            {
                console.log("an error has occurred " + error);
            }
        });
    };

    reader.readasbinarystring(f);
}
}


a: just "touch" the record with an update that doesn't change anything. similar to how user would hit edit and then save without changing anything on the page.
this will cause all workflows, validation rules etc to run of course!
something like this should be enough:
var parent = new sforce.sobject("account");
parent.id = customobj.id;
result = sforce.connection.update([parent]);

(even better if the object you're passing to the function already is created with this library and not some totally separate data structure you've made that has pretty much only the id attribute)
having said that... maybe you should have this bit of logic in a trigger and not javascript? should it work only for these uploads or anytime an attachment is added to your custom object?

user
In that passage, there are seventy-five occurrences of the letter "u."
assistant