- 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:38 AM
Hey Cedric,
You could try my code and check
post me your feedback
Please Hit ✅Correct, âÂ��Helpful, or ��Like depending on the impact of the response
Have a lovely day ahead
Regards,
Divya Mishra
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-16-2017 06:07 AM
Hey Cedric,
Write an onload client script :
then use this code:
if(g_user.hasRole('itil'));
g_form.setValue("field","value");
post me your feedback
Please Hit ✅Correct, âÂ��Helpful, or ��Like depending on the impact of the response
Have a lovely day ahead
Regards,
Divya Mishra
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-16-2017 06:46 AM
Hey Cedric,
Wrote this on incident form. It worked
Sample:
function onLoad() {
//Type appropriate comment here, and begin script below
if(g_user.hasRole("admin"));
g_form.setValue("urgency",'2');
alert("Changed urgency");
}
post me your feedback
Please Hit ✅Correct, âÂ��Helpful, or ��Like depending on the impact of the response
Have a lovely day ahead
Regards,
Divya Mishra
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-16-2017 06:49 AM
Hi Mishra,
i know i can ue onLoad clientscript, but i prefer set the value into default value field, because it's only needed when creating incident.
On load is called always you load the forms and is more complicated i think because need more test.
defalut value of a field is set only on creation of object that's why i think it's more good.
Regards,
Cedric
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-16-2017 06:56 AM