[sql] Cambio de valores con try catch
Viewer
- try {
- List<Merchant__c> recordsToUpdate = [SELECT Id, Merchant_s_Primary_Industry__c
- FROM Merchant__c
- WHERE Merchant_s_Primary_Industry__c IN ('Accupuncture', 'Alternative Medicine', 'Anesthesiologist', 'ASC', 'Funeral Services', 'Gastroenterology', 'Gynecology', 'Hospital', 'Neurosurgery', 'Oncology', 'Orthopaedic Care', 'Other - Inactive Value', 'Permanent Makeup',
- 'Pharmaceuticals', 'Reconstructive Surgery', 'Remodeling', 'Roofing', 'Sexual Reassignment Surgery', 'Substance Abuse/Rehab', 'Surrogacy', 'Tattoo Removal', 'Therapy/Behavioral', 'Urology', 'Vein Treatment', 'Water Filtration')];
- FOR (Merchant__c record : recordsToUpdate) {
- record.Merchant_s_Primary_Industry__c = 'Legacy';
- }
- UPDATE recordsToUpdate;
- } catch (DmlException e) {
- // Manejar la excepción DmlException
- System.debug('Error en la operación DML: ' + e.getMessage());
- }
Editor
You can edit this paste and save as new: