Update field on reference field table with business rule

Sam Motley
Giga Guru

Hi, 

 

I'm trying to update a field in another table using a reference field dot walking based on a condition on the original table. 

 

I have a custom true / false field on our cmdb_ci_computer table 

In the software installation table i'm looking for a particular software using display name and if it exists using the installed on field i'm trying to update the true/false field. 

 

i have tried business rules and workflow it looks like it's running but for whatever  reason the true/false field will not update. 

 

I've tried this method before and it's worked - does anyone know if there is something stopping the field updating on / from the software installation table? 

 

Cheers, 

1 ACCEPTED SOLUTION

Sid_Takali
Kilo Patron
Kilo Patron

Hi @Sam Motley Share your code which you tried and try below code

if (current.software.display_name == 'YourSoftwareName') {
    var computerGr = new GlideRecord('cmdb_ci_computer');
    if (computerGr.get(current.installed_on)) {
        computerGr.your_true_false_field = true; // or false depending on your logic
        computerGr.update();
    }
}

 

View solution in original post

5 REPLIES 5

Sid_Takali
Kilo Patron
Kilo Patron

Hi @Sam Motley Share your code which you tried and try below code

if (current.software.display_name == 'YourSoftwareName') {
    var computerGr = new GlideRecord('cmdb_ci_computer');
    if (computerGr.get(current.installed_on)) {
        computerGr.your_true_false_field = true; // or false depending on your logic
        computerGr.update();
    }
}

 

so simple i love it thank you , this seems to have done the trick although i don't know why "set values" wasn't working 

If you were trying this on the Actions tab without a script, that doesn't usually work when either side is a related field / dot-walk.  I'm not sure why the condition builder includes these since they don't seem to be able to be used.

Brad Bowman
Kilo Patron
Kilo Patron

You may have a Data Policy, ACL, or Business Rule preventing the update.  Are you able, as an admin, to update this field manually?  Have you logged your attempted BR script to confirm if/when it is running, the value it's attempting to update, etc?  Have you tried to update with the value true vs 'true'? Is there anything useful in the system log when the BR runs?