updating js create/update sample code