# Business Rule API example: edit a Business Rule to set billable service using cmdb_ci name and assign current domain ID

```typescript
import { BusinessRule } from '@servicenow/sdk/core'

BusinessRule({
    $id: '1a9b33736be23010bc5bffcd1e44af2e',
    action: ['insert'],
    filterCondition: 'cmdb_ci!=NULL^is_sample=false',
    script: `(function executeRule(current, previous /*null when async*/) {
    // Check if we have a CMDB CI
    if (current.cmdb_ci) {
        var ciGr = new GlideRecord('cmdb_ci');
        if (ciGr.get(current.cmdb_ci)) {
            // Set billable service using CMDB CI name
            current.billable_service = ciGr.name;
            
            // Assign current domain ID
            current.domain = gs.getCurrentDomainID();
            
            // Update the record
            current.update();
            
            // Log the update
            gs.log('Updated alert ' + current.number + ' with billable service: ' + ciGr.name + ' and domain: ' + gs.getCurrentDomainID(), 'BillingAlertsBusinessRule');
        }
    }
})(current, previous);`,
    table: 'em_alert',
    name: 'Billing Alerts',
    order: 100,
    when: 'after',
    active: true,
    addMessage: false,
    abortAction: false,
    condition:
        'gs.nil(current.getValue("sn_air_core_integration_usage")) || gs.nil(current.sn_air_core_integration_usage.integration) || !current.sn_air_core_integration_usage.integration.exempt_from_billing',
})
```
