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

Question

Question

Forms filter using active directory credentials

asked on November 6, 2018

Hi Team,

 

Wanted to know how this would be possible? 

 

I am using a filter to route forms submitted to specific users. I have found after a lot of trials and error the following:

1. If I have the AD\Username within the filter it based on the below Method:

if(_.indexOf(['AD\Username'],$util.getValue('FIELDNAME'))>-1)
{
$result=team.findMembersByRole('ROLEASSIGNED');
}

If I have lines in this filter and remove the >-1 as per below for the top line,

if(_.indexOf(['AD\Username'],$util.getValue('FIELDNAME')))
{
$result=team.findMembersByRole('ROLEASSIGNED');

if(_.indexOf(['AD\Username'],$util.getValue('FIELDNAME'))>-1)
{
$result=team.findMembersByRole('ROLEASSIGNED');

It will give me the output for the first line, but if I test it with the 2nd AD\Username user, it results with output for the first line again? 

 

If I then change the >-1 around and input it in the last line as per below:

if(_.indexOf(['AD\Username'],$util.getValue('FIELDNAME'))>-1)
{
$result=team.findMembersByRole('ROLEASSIGNED');

if(_.indexOf(['AD\Username'],$util.getValue('FIELDNAME')))
{
$result=team.findMembersByRole('ROLEASSIGNED');

The result of that always defaults to the last ROLEASSIGNED

 

2. If I change this setup / the script to the below:

if($util.getValue('FIELDNAME') == 'AD\Username)
{
$result=team.findMembersByRole('ROLEASSIGNED');
}
if($util.getValue('FIELDNAME') == 'AD\Username')
{
$result=team.findMembersByRole('ROLEASSIGNED');
}

This always errors out with the below:

 

but if I change it slightly and remove the AD part as per below:

if($util.getValue('FIELDNAME') == 'Username)
{
$result=team.findMembersByRole('ROLEASSIGNED');
}
if($util.getValue('FIELDNAME') == 'Username')
{
$result=team.findMembersByRole('ROLEASSIGNED');
}

 

That works without any issues. 

As the client AD is setup with Name and Username being AD\Username how can I target this with Filters? 

 

Many thanks in advance, 

Ziad

1 0

Answer

SELECTED ANSWER
replied on November 12, 2018

Hi Ziad,

 

Have you tried 

$util.getValue('FIELDNAME') == 'AD\\Username' or $util.getValue('FIELDNAME') === 'AD\\Username'

 

Your comparison of 'Fieldname' == 'AD\Username' may not evaluate correctly due to the single "\". 

 

Kind Regards,

 

Aaron

0 0

Replies

replied on November 8, 2018

Hi All,

 

Any feedback on this? 

 

Many thanks

Ziad

0 0
replied on November 12, 2018

Hi Aaron,

 

Will be trying this out very soon, was waiting for some feedback, 

 

Many thanks,

Ziad

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

Sign in to reply to this post.