Validation on a choice and reference type of field

Divya95
Tera Contributor

Hi ,

We have a choice field with choices INC,CRQ . But if the external system provides value as PKE ,field has got added with a new choice value  PKE to the dictionary . . Same field is used in other form with different choices .How do i perform server side  validation on such choice field to accept only the defined values .

Similarly for reference type of field , if the reference value doesnt exist in database ,it creates a new record with given value .How to perform validation for such case

 

 

 

3 REPLIES 3

Shashikant Yada
Tera Guru

Hi,

 

How you are trying to add the values in it? Also to which table is the reference type is applied?

 

Thanks

Shashikant 

Gurpreet07
Mega Sage

In Transform map corresponding to mapping of this filed you need to select ignore in choice action.

https://docs.servicenow.com/bundle/kingston-platform-administration/page/script/server-scripting/task/t_CreatingAFieldMap.html 

Hi Gurpreet,

You should write a field script on the transform map and if you are writing  it for choice field you need to get all the choices of that field from sys_choice table and validate it , same for reference field glide on the table to which it references and validate data. if not found then just return "" from that field .

You can refer below screenshots if you dont know were to write the field script.

Just open the field from the fieldMAP and write the script for validation in it.

Please mark as helpful if found helpful.

Regards,

Dhananjay.