How to add data to previous added data in description (script)

DIVI1
Tera Expert

I have to add data to description on record Producer script field.

 

Look it's not as easy as i though, I have part of script which is working properly: 

current.description = 'Store: ' + "\n" + producer.store.getDisplayValue() + "\n" +
 'Division: ' + "\n" + producer.division.getDisplayValue()  + "\n" + 'Department: ' + "\n" 
 + producer.department.getDisplayValue();
current.short_description = 'Allocation Request';

 

And after that I want to add extra data to current.description if:

else if(producer.b_baby_boys_outerwear == 'true'){
current.description = 'baby: ' + "\n" + producer.b_baby_boys_outerwear;
}

but description is overwritten...

 

How to get resolve?

1 ACCEPTED SOLUTION

_Gaurav
Kilo Sage

Hi @DIVI1 
If I have understood your requirement correctly, this needs to be done in a single go.

if(producer.b_baby_boys_outerwear == 'true'){
current.description = current.description + 'baby: ' + "\n" + producer.b_baby_boys_outerwear;
}

View solution in original post

8 REPLIES 8

It's working only when I'm using 'if', unfortunately not working with 'else if'

That is entirely possible of course, I don't know exactly how your variables are filled of course.

However the solution itself is correct, only the rest of your logic was not 😉


Help others to find a correct solution by marking the appropriate response as accepted solution and helpful.

_Gaurav
Kilo Sage

Hi @DIVI1 
If I have understood your requirement correctly, this needs to be done in a single go.

if(producer.b_baby_boys_outerwear == 'true'){
current.description = current.description + 'baby: ' + "\n" + producer.b_baby_boys_outerwear;
}

Thanks Working properly!