How to fix it
- Navigate to
System Definition > Business Rulesand open your Business Rule. - Check the
Whenfield. If it's set toafter, you need to callgr.update()after yoursetValue()calls. - If in an after rule, modify your script to:
current.setValue('field_name', 'value'); current.update(); - If it's a before rule, check for conflicting Business Rules by filtering
System Definition > Business Rulesby your table name. - Sort by
Orderand look for otherbeforeorbeforerules with higher Order values that modify the same field. - If found, either adjust the
Orderof your Business Rule to run last, or modify the conflicting rule's condition to avoid overwriting your value. - For reference fields, verify you're using
setValue()with the sys_id, notsetDisplayValue()with the display name. - Check field permissions by navigating to
System Definition > Tables & Columnsand searching for your table and field name. - Verify the field's
Read onlycheckbox is unchecked and noDefault valueis conflicting with your setValue(). - Add logging to verify your setValue() is executing:
gs.info('Setting field to: ' + value); current.setValue('field', value);
Test your fix by triggering the Business Rule and checking System Logs > System Log > All for your debug message, then verify the field value in the record.