how to display reference field variable value starts with the letter X
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-24-2024 05:39 AM
HI,
I have 2 variables account(choices - abc, def), account name(reference data type - the value coming from sys_user table).
if the account value abc, the account name displays values where samaccountname starts with x.
if the account value def, the account name displays values where samaccountname starts with Y.
User can use wildcard search on the fields being displayed.
Thanks.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-24-2024 06:46 AM - edited 06-24-2024 06:48 AM
Hello @BanuMahalakshmi ,
1. You can create onchange/ onload client script on the required table.
2. get value of both choice and reference fields (if sys_id then use getDisplayValue()) use two seperate variables for reference field to get value starts with x and y seperately. you can use indexOf() > -1 or starts with in condition.
3. use condition if choice = abc then set reference field value = var of x and else if vice versa.
You can refer below article that was exactly reverse to your requirement:
https://www.servicenow.com/community/developer-forum/set-choice-field-based-on-the-reference-field/m...
https://support.servicenow.com/kb?id=kb_article_view&sysparm_article=KB0785188
If my solution helps you any way then mark it as accepted and helpful.
Thank You!!
Thank you!!
Dnyaneshwaree Satpute
Tera Guru