The word 'Null' appearing when clearing out the value within a field on an application service

matthew_hughes
Kilo Sage

On an application service record, the name field is made up of the Business Application Name and Instance Descriptor field:

 

matthew_hughes_0-1741593066054.png

 

What we've noticed is that if a user clears the Instance Descriptor field manually within the form, it updates the Name to just reflect the Business Application Name field as expected:

matthew_hughes_1-1741593311960.png

 

A user who doesn't have access to the application services table can carryout this amendment via a Data Only change request:

matthew_hughes_2-1741593482195.png

So a user can clear out the Instance Descriptor field and click Save Proposed Changes

 

Once the change record has been approved, the user can then click on the Apply Proposed Changes button:

matthew_hughes_3-1741593618404.png

 

However, what we've noticed is that when a user clicks on Apply Proposed Changes, the Instance Descriptor field does get cleared out as expected, but the Name field includes the word Null instead of just updating the Name with just the Business Application Name value:

matthew_hughes_4-1741593707905.png

 

matthew_hughes_5-1741593844676.png

 

The change is triggered by the following Business Rule:

matthew_hughes_6-1741593955539.png

The below code is from within the Advanced tab:

if (current.operation() == "update" && current.u_bus_app_name != '') {
        if (current.u_instance_descriptor.changes()) {
            if (current.u_instance_descriptor != '' && current.u_instance_descriptor != 'NULL') {
                gs.log("KM2 Instance Descriptor first block: "+current.u_instance_descriptor);
                current.name = current.u_bus_app_name.name.toString() + "_" + current.u_instance_descriptor;
            } else if (current.u_instance_descriptor == '' || current.u_instance_descriptor == NULL || current.u_instance_descriptor == 'NULL' || current.u_instance_descriptor == null || current.u_instance_descriptor == 'null'|| current.u_instance_descriptor == '_NULL') {
                gs.log("KM2 Instance Descriptor second block: "+current.u_instance_descriptor);
                current.name = current.u_bus_app_name.name.toString();
            }
        }

    }

 

 

10 REPLIES 10

@matthew_hughes 

is that the same table on which business rule is created?

I assume it's not a dot walked field added on form via some other reference field?

What happens when business rule runs with admin?

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

@Ankur Bawiskar 

The same table on the Business rule is correct

 

It's not a dot walk field, it's a text field.

 

Do you mean when a Data Only change is raised via admin or when an admin manually amends the Instance Descriptor field within the Application Service?

@matthew_hughes 

yes if system admin initiates the action and business rule runs? then what comes in log?

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

When I click 'Apply Changes' as admin via a data only change record, I don't get any results back. I only seem to get logs when I update the field manually:

matthew_hughes_0-1741598513966.png

 

@matthew_hughes 

seems you are not able to access the field value itself?

Is that an encrypted field? any field level READ ACL is blocking?

share that field type screenshot from dictionary

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader