Record Producer Script is not working

Hari Babu
Mega Expert

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';

}

 

1 ACCEPTED SOLUTION

shanecarroll
Mega Expert

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';
}

 

 

View solution in original post

11 REPLIES 11

SatheeshKumar
Kilo Sage

try  logging the value of variable abc and check the values used to compare are correct.

Thanks for your response

 

Not working properly  

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';

}

 

 

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