- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-16-2024 12:05 PM
Hello,
Below is a script include that when it gets to the section that is this color, it doesn't pick up the var backDating part that is part of the correction part of the function. I can get a gs.addInfoMessage just inside of that part of the function, but I can't get a gs.addInfoMessage just past that part of the function, therefore, the conditions are skipped over. What do I need to change here please so that it is picking up the var backDating.
Thank you ahead of time for any help on this script.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-16-2024 02:25 PM
OK, so ct is some comma-separated value, and the system property contains a value to search for.
I'm going to assume that's like ct = sys_id1,sys_id2,sysid3.., and the Value of the system property is one of those sys_ids. Let me know if this is not remotely close.
You can use indexOf in an array or string, but if all you are trying to determine is if the sys_id that is the Value of the system property appears anywhere in the field value, you don't need an array, so leave that out. With the logs of ct and the system property still there as a sanity check, if you add back in the backDating line then log that variable right after, what do you get?
One thing you should do that shouldn't matter but can't hurt is force the values to a string, since they contain sys_ids. Stranger things have worked. And maybe get ridiculous with breaking this apart and logging to see if that sheds any light:
var ct = current.type_of_correction_requested.toString();
gs.info ('AK ct= ' + ct);
var sysprop = gs.getProperty('x_mtbr_ebs_rdep.redp.backdating_request').toString();
gs.info ('AK sysprop= ' + sysprop);
var backDating = ct.indexOf(sysprop) >= 0;
gs.info ('AK backDating= ' + backDating);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-18-2024 03:42 AM
The more I've thought about this, it makes sense that your original script stopped working in the ct area as the typeof the ct variable is likely not a string and you are attempting string functions with the split and indexOf. If you just force ct to a string it should work, but maybe the system property needs the same since it's probably a string value of a sys_id, it might get interpreted differently when retrieved.
var ct = current.type_of_correction_requested.toString();
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-18-2024 09:24 AM
Hi Brad,
Your solution helped me arrive at the final solution to get this to work as expected. I greatly appreciate your help.
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-16-2024 02:01 PM
The logic is correct, you can search for the string both in full string and in the array. As @Brad Bowman suggested try to debug both the array ct that you created with the 'split' and the property 'x_mtbr_ebs_rdep.redp.backdating_request' with gs.info() to make sure they have values as expected.