The CreatorCon Call for Content is officially open! Get started here.

indexOf() not working in client script

surbhi_123
Tera Expert

I have an onChange client script where value is getting fetched from script include. I want that the value that is getting from script include to populate in the variable only if it's value starts with OPE. 

surbhi_123_0-1694614089015.png

But this is not updating any value, if I remove the line no 18 it fetches the correct value and sets to the variable

1 ACCEPTED SOLUTION

Hi,
You should return the display value of the cost center instead of SYS_ID.

Sample code for your Script Include

gr.getDisplayValue('cost_center');

 

 


Thanks and Regards,

Saurabh Gupta

View solution in original post

9 REPLIES 9

Saurabh Gupta
Kilo Patron

Hi,
Can you please put an alert statement before if statement alert(answer.indexOf('OPE')) and give the screenshot.

 

 


Thanks and Regards,

Saurabh Gupta

Here it is

surbhi_123_0-1694615060150.png

 

Hi,
Also alert the answer as well, it seems your string does not have OPE.



Thanks and Regards,

Saurabh Gupta

surbhi_123_2-1694616463041.png