- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-16-2017 06:03 AM
Hi,
in my incident Forms i try to set the value of 'contact_type' field (field is a choice list)
using javascipt into default value, i want to set the value for user have a specific role
in first time i just try with role 'itil'
i write this :
javascript:if (gs.hasRole("itil")) {phone} else {portail};
but not work
later i will create a special role 'hotliner_role' and use this role.
regards,
Cedric
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-16-2017 07:06 AM
Hi Tomasi,
finally with you're help and sample code finded into System>Dictionary
i write this :
javascript:(function() {if (gs.hasRole('itil')) return 'phone'; else return 'portail';})()
and IT'S WORK YES !!!
great thanks for you're help
Best regards,
Cedric

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-16-2017 06:53 AM
javascript:if (gs.hasRole('itil')) current.contact_type = 'phone' else current.contact_type='portal';
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-16-2017 07:06 AM
Hi Tomasi,
finally with you're help and sample code finded into System>Dictionary
i write this :
javascript:(function() {if (gs.hasRole('itil')) return 'phone'; else return 'portail';})()
and IT'S WORK YES !!!
great thanks for you're help
Best regards,
Cedric

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-16-2017 07:07 AM
Thanks for the update. I'm not sure it had to be enclosed in an anonymous function, but that's great that you got it working.
Thanks for sharing the solution!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-16-2017 06:07 AM
Hi cedric, Please check this link it will help you https://docs.servicenow.com/bundle/jakarta-servicenow-platform/page/administer/field-administration/...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-16-2017 06:36 AM
Hi Mishra,
I based my code on this exemple, but not sure it's correct, because it's not work.
i need to be sure not existing clientScript update this field after.
but don't know if my code is correct ;(
Regards,
Cedric