Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Need to create new field with default value

navdeep_singh
Giga Guru

I want to create a new field (integer) with a value"0" on Incident table.   I want this value to be applied on new as well as existing records.

Will the "Default Value" work? if not please suggest any other option.

Thank you,

Navdeep

1 ACCEPTED SOLUTION

And they weren't updated:


find_real_file.png



Yes, we did it differently.



I went through the dictionary



1. went to System Definition -> Dictionary. Clicked on new


2. Choose the incident table, Integer type, and added 0 as default value:


find_real_file.png


3. Clicked on Submit


4. Run the script to confirm:


find_real_file.png


find_real_file.png



Telmo


View solution in original post

14 REPLIES 14

aha...cool


-Anurag

Chuck,



I've also checked that before replying, and:


find_real_file.png



Telmo


Interesting. I wonder what we did differently. To compare notes here's what I did:


  1. Went to the incident list
  2. Used Configure table
  3. Added new field called Count (u_count) with a default value 0
  4. Clicked Update
  5. Ran the script above.

Any difference?


And they weren't updated:


find_real_file.png



Yes, we did it differently.



I went through the dictionary



1. went to System Definition -> Dictionary. Clicked on new


2. Choose the incident table, Integer type, and added 0 as default value:


find_real_file.png


3. Clicked on Submit


4. Run the script to confirm:


find_real_file.png


find_real_file.png



Telmo


Hi Telmo,



I just checked, it is working for me also. Is there any particular condition when the default value will affect the existing records.



Scenario 1)   -I have created new field using Form Layout then set the default value by configure dictionary .


          Result - did not work for existing records.


Scenario 2) I have created new field from Tables >> Incident >> Table Colums >> using Embeded List


                  Result -did not work for existing records.


Scenario 3) I have created new field from Tables >> Incident >> Table Colums >> New


                  Result -   Worked



Issue - If a new field is created by using two methods   Scenario 1), Scenario 2),   how can i set the value for existing records?