- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-24-2017 01:54 AM
Hi,
I am trying to make a client script with the condition View == self_service and if true I want to set the state to Active. Here's my code but it is not working. Do you have any other way to meet what I am trying to do?
function onLoad() {
//Type appropriate comment here, and begin script below
var view = getView();
if (view == 'self_service'){
g_form.setValue('state','2');
}
}
Solved! Go to Solution.
- Labels:
-
Best Practices
-
Team Development
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-24-2017 02:04 AM
- function onLoad() {
- //Type appropriate comment here, and begin script below
- var view = getView();
- if (view == 'ess'){ //self service view name is ess so make to ess
- g_form.setValue('state','2');
- }
- }
try this script.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-24-2017 02:04 AM
- function onLoad() {
- //Type appropriate comment here, and begin script below
- var view = getView();
- if (view == 'ess'){ //self service view name is ess so make to ess
- g_form.setValue('state','2');
- }
- }
try this script.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-24-2017 02:32 AM
Hi Balaji,
Thank you so much for your quick response. I changed the name to 'ess' and got the feature that I want. Thanks again for your help.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-20-2020 08:23 PM
Hi balaji ,
I do have similar kind of issue that in self service view if i submit a ticket ,in the default view the following field(category ,sub category,business services) should populate with the value " To be classified"and assignment group to be help desk.
But unfortunately the script that i wrote in Business rule (after insert)does not work.
May i know what went wrong in the script below:
(function executeRule(current, previous /*null when async*/) {
if (getView() == 'ess'){
current.category='to be classified';
current.subcategory='To be classified';
current.description=current.u_description;
current.business_service=current.u_impactedservices;
current.assignment_group='d083a34cdbfc04102db740a505961902';
if(current.u_impactedservices==''){
current.business_service.setDisplayValue('To be classified');
}
current.update();
}
})(current, previous);
Thanks in advance

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-17-2023 05:21 AM
Hey, I do have similar requirement like once form submitted from self-service view the 'contact_type' should be set to self-service on default view.
i created client script on-submit, and selected 'ess' view and done the following code, can you tell me what's wrong here, it's not setting the value
function onSubmit() {
var view = getView();
if (view == 'ess'){
g_form.setValue('contact_type', 'self-service');
}