- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-10-2019 11:41 PM
Hi Folks,
I have written script for to auto populate Short description in service request form with below data,
we have variable Type for request under that 3 dropdown 1.new desk phone 2.change desk phone 3.conferencing
when new desk phone is select then auto populate in service request form short description field that droop down values
Script Written :-
It is not working properly when i select any drop down it is taking default "Conferencing-Desk Phone and Conferencing".
var abc = producer.type_of_request;
if(abc == 'new desk phone' || abc == 'change desk phone' || abc == 'conferencing')
{
current.short_description='New Desk Phone-Desk Phone and Conferencing';
current.short_description='Change Desk Phone-Desk Phone and Conferencing';
current.short_description='Conferencing-Desk Phone and Conferencing';
}
Solved! Go to Solution.
- Labels:
-
Best Practices
-
Service Catalog
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-10-2019 11:58 PM
Your script is matching all the time and setting the last value
you should seperate into if else statements i.e something like this
if(abc == 'new desk phone'){
current.short_description='New Desk Phone-Desk Phone and Conferencing';
} else if( abc == 'change desk phone'){
current.short_description='Change Desk Phone-Desk Phone and Conferencing';
}else {
current.short_description='Conferencing-Desk Phone and Conferencing';
}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-10-2019 11:48 PM
try logging the value of variable abc and check the values used to compare are correct.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-10-2019 11:53 PM
Thanks for your response
Not working properly

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-11-2019 12:06 AM
oh i missed it before,your code has an issue. it should be like below
var abc = producer.type_of_request;
if(abc == 'new desk phone' )
{
current.short_description='New Desk Phone-Desk Phone and Conferencing';
}
else if(abc == 'change desk phone' )
{
current.short_description='Change Desk Phone-Desk Phone and Conferencing';
}
else if( abc == 'conferencing')
{
current.short_description='Conferencing-Desk Phone and Conferencing';
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-11-2019 01:46 AM
Thanks for your response ,
So this record Producers ,
I want write in Catalog item below one , how could we write the script ,
we have variable Type for request (variable) under that 3 dropdown 1.new desk phone 2.change desk phone 3.conferencing
when new desk phone is select then auto populate in service request form short description field that droop down values