You are viewing limited content. For full access, please sign in.

Question

Question

team filter script test error

asked on January 29, 2024

I have the following code:
 

var deptChief = team.findMembersByRole('Deputy Chief');
var districtChiefs = team.findMembersByRole('District Chief');
var trigger = $util.getValue('Vacancy_Type');

if (trigger == null) {
$result = $util.union(deptChief, districtChiefs);
} else {
  $result = deptChief;
}

When I test the filter in the edit filter window with an empty Vacancy_Type value


The result is just the deputy chief variable and not the deputy chief and district chiefs together.

However, it generates the correct result (deputy and district chiefs list) when it runs in the instance. This isn't a big issue because when it runs in the instance it is correct, but it does mess up testing/debugging if I were to try to write a new filter script for something else and needed to test something I wasn't sure about. I looked to see if anyone else has posted about this issue but didn't see anything so I wanted to bring it up as a potential bug. 

0 0

Replies

replied on January 29, 2024 Show version history

I wonder if it is the difference between a NULL value and an empty string in the testing?

What if this line: 

if (trigger == null) {

 

Was changed to this: 

if (trigger == null || trigger == '') {

 

Would you get the same result?

 

Also - just a side note of something I wish I had known a lot sooner...  Did you know about the   $test   functionality within the task assignment filter scripts in LFForms?  It is explained at the bottom of this page on the help documentation.  Using it can give you a lot more detail about what information is being included in different parts of your script if things are not behalving the way you expect.

2 0
replied on January 29, 2024

Changing the code as you recommended made it so that the test window generated the correct results.

Also, thank you for the link info! I didn't know that we could test that way. 

1 0
replied on January 29, 2024

Happy to help!  smiley

0 0
replied on January 30, 2024

To add to the above issue. I think the fact that empty variables are handled as null within the instance affects how they are handled in gateways. Several gateways have started to have issues since the update when the gateway condition is set to be taken when the variable is equal to ''. The screenshot example below shows the path that was supposed to be taken but caused a suspension instead. 

0 0
You are not allowed to follow up in this post.

Sign in to reply to this post.