Welcome to Community Week 2025! Join us to learn, connect, and be recognized as we celebrate the spirit of Community and the power of AI. Get the details  

how to set field value as Yes on basis of assessment table.

keval3
Tera Contributor

Hi All,

 

I have below requirement...

 

There is one table called Assessment instance in that table when state is completed. at that time there is  one  custom table called F&F in that table there is one field called interviews conducted in witch 2 choices are available Yes/No  it should automatically set as yes.

 

in short when Assessment instance's state is completed at that time FNF tables field ( Interview conducted) should set as yes.

 

please let me know the solution.

 

Thanks & Regards

KP   

2 REPLIES 2

Tony Chatfield1
Kilo Patron

Hi, unfortunately your post does not contain any clear detail that would allow the community to provide a specific solution, but assuming there is a relationship\reference between Assessment instance and F&F table

then all you should need is an after update BR on Assessment instance, when a record state is set to the required value, utilize GlideRecord to lookup the F&F record using the relationship\reference and update the record as required.

Deepak Shaerma
Kilo Sage
Kilo Sage

Hi @keval3 

As i understand your requirement, you can create a Business Rule on the “Assessment Instance” table that triggers when the state changes to “Completed”. This Business Rule will then update the associated record(s) in your custom “F&F” table to set the “Interviews Conducted” field to “Yes”. 

Create a Business Rule

1. Navigate to System Definition > Business Rules in your ServiceNow instance.
2. Click on the New button to create a new Business Rule.
3. Fill out the form:
Name: Enter a descriptive name.
Table: Select the “Assessment Instance” table from the dropdown list.
When to run:
- Check the After checkbox, as you want this to run after the record has been updated.
- Choose Update to have the script run when an assessment instance is updated.
- Under Conditions, specify the script to run only when the record’s state changes to “Completed”.

// Ensure the script runs only if the state is set to ‘Completed’
// Use the appropriate value or field that represents “Completed” status //
    if (current.state == 'completed' ) {
    
        // Fetch the related F&F record. Assuming ‘assessment_instance’ is the reference field in F&F pointing back to Assessment Instance
        var ffGR = new GlideRecord('custom_ff_table'); // Replace ‘custom_ff_table’ with the actual table name of F&F
        ffGR.addQuery('assessment_instance', current.sys_id); // Adjust ‘assessment_instance’ to the correct field name if needed
        ffGR.query();
        
        while (ffGR.next()) {
            // Assuming ‘interviews_conducted’ is the field you want to set to ‘Yes’
            ffGR.interviews_conducted = 'yes'; // Adjust ‘yes’ if the choice value for “Yes” is different in your setup
            ffGR.update();
        }
    }


Note: Please Mark this Helpful and Accepted Solution. If this Helps you to understand. This will help us a lot.
Thanks & Regards 
Deepak Sharma