Use PDIs? Take our 5-minute survey to help shape the PDI roadmap.

Create a custom script in a String field

David Garcia
Tera Contributor

Hello, all.

 

I am trying to write a script in a String field that checks the Description field for key words to validate the creation of a ticket. 

I found this one already setup in my instance, but I am not sure if is working:

DavidGarcia_0-1730741382173.png

 

 

I tried using the same code to create a new validation:

Title_codeIN["Loan Officers", "Loan Officer Assistants", "Branch Manager", "Production Manager", "Division Manager", "Regional Manager", "Mortgage Credit Specialist "]

 

That didn't work so I tried altering it to look like this:

descriptionCONTAINS"Loan Officer"^ORdescriptionCONTAINS"Loan Officer Assistant"^ORdescriptionCONTAINS"Branch Manager"^ORdescriptionCONTAINS"Production Manager"^ORdescriptionCONTAINS"Division Manager"^ORdescriptionCONTAINS"Regional Manager"^ORdescriptionCONTAINS"Mortgage Credit Specialist"

 

The description field looks like this and I want it to check the Title field or any text within the description field:

DavidGarcia_1-1730741535927.png

 

4 REPLIES 4

David Garcia
Tera Contributor

Or is there a better way to do this?

Runjay Patel
Giga Sage

Hi @David Garcia ,

 

Not sure what the business requirement but 2nd approach works. If you can tell me your Business requirement then i can may suggest you some alternative way.

 

 

descriptionCONTAINS"Loan Officer"^ORdescriptionCONTAINS"Loan Officer Assistant"^ORdescriptionCONTAINS"Branch Manager"^ORdescriptionCONTAINS"Production Manager"^ORdescriptionCONTAINS"Division Manager"^ORdescriptionCONTAINS"Regional Manager"^ORdescriptionCONTAINS"Mortgage Credit Specialist"

 

 

-------------------------------------------------------------------------

If you found my response helpful, please consider selecting "Accept as Solution" and marking it as "Helpful." This not only supports me but also benefits the community.


Regards
Runjay Patel - ServiceNow Solution Architect
YouTube: https://www.youtube.com/@RunjayP
LinkedIn: https://www.linkedin.com/in/runjay

-------------------------------------------------------------------------

 

Part 15. In this video i have talked about Access Control List (ACL) in details. I have explain below. 1. Overview on ACL. 2. How to create ACL. 3. Different types of ACL. 4. How ACL works. 5. Execution order of ACL. 6. ACL Evaluation 7. Debug ACL 8. ACL Troubleshoot. 9. Real time use case live ...

Ankur Bawiskar
Tera Patron

@David Garcia 

What's your business requirement for this?

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

David Garcia
Tera Contributor

The business requirement is to only have a ticket created when the Title equals those titles listed. As of right now, a RITM drops for all titles. The first image in my original post is from a custom table that was created to act as a Trigger to create a RITM depending on if a box is checked on a form outside of ServiceNow. 

 

DavidGarcia_0-1731004146369.png