- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-13-2023 07:09 AM
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.
But this is not updating any value, if I remove the line no 18 it fetches the correct value and sets to the variable
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-13-2023 07:49 AM - edited 09-13-2023 07:52 AM
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-13-2023 07:27 AM
Hi @surbhi_123
Can you please reverify what type of data answer is storing. Just add alert(answer) after line no. 17 and check.
Please Mark My Response as Correct/Helpful based on Impact
Krishna Sharma
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-13-2023 07:47 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-13-2023 07:49 AM - edited 09-13-2023 07:52 AM
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-13-2023 11:10 AM
Hi @surbhi_123 ,
You are getting Sys ID that's why indexOf is not working. To fix this you should return display value from script include or replace 'OPE' with the Sys ID.
Please Mark My Response as Correct/Helpful based on Impact
Krishna Sharma
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-13-2023 07:28 AM - edited 09-13-2023 07:30 AM
Hi @surbhi_123,
There is a curly brace missing after if statement, can you set the value inside the if statement and try.
if(answer.indexOf('OPE')>-1){
g_form.setValue('cost_center', asnwer);
}
Please Mark this answer as correct and helpful if it solves your issue.
Regards,
Siva Jyothi M.