- 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-16-2024 12:36 PM
I would start by logging ct before the split and
gs.getProperty('x_mtbr_ebs_rdep.redp.backdating_request')
to make sure you have expected values in both of those before trying to use them.
What are you trying to get for backDating? You probably either want to not split ct so that you are executing this search on the full string instead of an array, and maybe get rid of the >=0.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-16-2024 02:03 PM
Hi Brad,
So, the field allows the user to select more than one option for the type of correction requested, which is why the array is being utilized. So, I need to ensure that no matter what order the user selects the options in, that if backDating is included, it sees it.
When I tried logging ct before the split and
gs.getProperty('x_mtbr_ebs_rdep.redp.backdating_request')
, I get nothing at that point either, so I am not sure what it isn't liking right now.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-16-2024 02:05 PM
Sorry, I forgot I had the lines commented out and I am indeed getting back a value for the logs mentioned above as expected.
- 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);