what is the use of conditional string?? explain

sensiplesoftwar
Mega Contributor

what is the use of conditional string?? explain

3 REPLIES 3

PrashantLearnIT
Giga Sage

Hi Deepika,



You would just use a string field here, but then apply a Client Script to that field to enforce the specific syntax with a regular expression (regex). I have an example that checks that the appropriate number of characters have been entered, and formats appropriately or lets the user know if they did not input properly. I've made a slight modification here to match your description. What it essentially does is checks for the format you want. If it does not match, is strips out all the non-digits to see if there are 6 digits. If there are, then it puts them in the appropriate format with FA at the front. If not, it posts a message letting the user know what format to enter. You would need to replace FIELDNAME with the field you are using. I think this will do what you are looking for.


********************************************************************************************************
Please appreciate the efforts of community contributors by marking the appropriate response as the correct answer and helpful. This may help other community users to follow the correct solution in the future.

********************************************************************************************************
Cheers,
Prashant Kumar
ServiceNow Technical Architect


Community Profile LinkedIn YouTube Medium TopMate
********************************************************************************************************

Shishir Srivast
Mega Sage

Please check if this helps: Using Condition String field type


Introduction to Fields - ServiceNow Wiki


Condition String : Text field that accepts a plain JavaScript condition statement that is validated automatically for correctness before an update.


The SN Nerd
Giga Sage
Giga Sage

It is just how the condition field is saved in the database.


It is also used in scripting:



gr.addEncodedQuery()


GlideFilter.CheckRecord()



etc.



ServiceNow Nerd
ServiceNow Developer MVP 2020-2022
ServiceNow Community MVP 2019-2022