You need to sign in to do that
Don't have an account?
Adam Rycroft
List View Button to select Picklist Values for Checked Records
I've set up this List View Button to select a certain picklist value for all checked records. Is it possible to create a single List View Button where the user is able to select which picklist value to enter rather than a pre-determined one?
!REQUIRESCRIPT('/soap/ajax/30.0/connection.js')} try{ /* Getting IDs of all the Selected Records. */ var selectedRecords = {!GETRECORDIDS( $ObjectType.PSH_Check__c )}; /* Ensure that atleast 1 record is selected */ if(selectedRecords.length > 0){ /* Creating an Array to store the Records that are to be Updated. */ var recordsToUpdate = []; /* Loop thro' each ID and then create a record of Type: PSH_Check__c. Then assign values to the appropriate Fields and finally add it to the recordsToUpdate array. */ for(var i = 0; i < selectedRecords.length; i++){ var record = new sforce.SObject('PSH_Check__c'); record.Id = selectedRecords[i]; record.check_status__c = "Mailed"; recordsToUpdate.push(record); } /* Update all the records */ var result = sforce.connection.update(recordsToUpdate); /* Showing the result of the Update */ var message = ''; var failedCount = 0, successCount = 0; for(i = 0; i < result.length; i++){ if(result[i].getBoolean('success') != true){ failedCount++; message = message + '\n>>' + result[i].errors.message; } else{ successCount++; } } alert( '::Mass Update Status::\r\n' + 'Total Submitted: ' + (failedCount + successCount) + ' Record(s)\n' + 'Total Updated: ' + successCount + ' Record(s)\n' + 'Failed to Update: ' + failedCount + ' Record(s)\r\n' + message ); /* Reload the Page */ location.reload(); } else{ alert('Please select atleast one row'); } } catch(e){ alert( 'An Un-expected Error has Occurred. Error:' + e ); }