Forum Discussion

dp_119903's avatar
dp_119903
Icon for Cirrostratus rankCirrostratus
May 18, 2018

Assign a variable based on AD query

I think I have this figured it but was hoping to get a sanity check.

I have an access policy that is querying AD. Later on I am sending an email to the user but there are two potential email fields.

If the user has f5EmailAddress as an AD attribute then I need to use that - if they don’t then I need to use session.ad.last.email.

I think this should just be a variable assignment after the AD query but I’m not sure if my syntax is correct.

Here’s what I have (forgive me in advance I’m writing this on an iPhone)


session.custom.company.email = if { ( [mcget {session.ad.last.attr.f5ProfileEmailAddress}] contains “@“)} { return ([mcget {session.ad.last.attr.f5ProfileEmailAddress }]} else { return ([mcget {session.ad.last.attr.email}])}

2 Replies

  • ...I should add my approach here is to just assign a custom variable session.custom.company.email - and have that variable be what is in the “to” field on the email.

     

    So my hope is that this logic will look and see if there is the f5EmailAddress variable and if there is assign it to the custom field and if not then assign the regular AD email field.