Business rule to update Businessunit field when the cmdb_ci record is updated or created by a user

Uttam Sai
Tera Contributor

Hi Team,

 

I have a requirement to update Businessunit (Reference field) to "A" when a cmdb_ci record updated or created by a particular user(X). Else the Businessunit should be updated with value "B". Could you please help me with the Business Rule which will be written on Configuration Item(cmdb_ci) table and it should be applicable to all the child tables on cmdb_ci table. This rule should run When ever a record is either inserted or updated in cmdb_ci table or any of it's child tables(Ex IP address table(cmdb_ci_ip_address)

Please let me know if you need any further details.

 

Thank you  

1 ACCEPTED SOLUTION

JT07
Tera Expert

Hi @Uttam Sai , it looks like you already have required information , you can create Before BR on insert/update.

table - cmdb_ci

script : 

if (current.sys_created_by == "A" || current.sys_updated_by == "A") {
        current.business_unit = 'bb06c204870221003ff35d88e3e3ec88'//Finance
    } else {
        current.business_unit = '9dd58ec0870221003ff35d88e3e3ec16'//HR
    }

 

Hope this helps, let me know if you have faced any particular issue?

 

View solution in original post

2 REPLIES 2

JT07
Tera Expert

Hi @Uttam Sai , it looks like you already have required information , you can create Before BR on insert/update.

table - cmdb_ci

script : 

if (current.sys_created_by == "A" || current.sys_updated_by == "A") {
        current.business_unit = 'bb06c204870221003ff35d88e3e3ec88'//Finance
    } else {
        current.business_unit = '9dd58ec0870221003ff35d88e3e3ec16'//HR
    }

 

Hope this helps, let me know if you have faced any particular issue?

 

Uttam Sai
Tera Contributor

Hi @JT07 ,

 

For some reason , the current.sys_updated_by == "A"is not working . The Business rule runs fine when CI is created by "A" but not when updated by "A" , could you please help what can cause this issue. Could any other BR affects this?