0 votes

Hi!

I'm new to Adaxes and this is my first post.

I need som assistance on writing an entered phone number on one hand for the human eye in the telephone attribute but on the other hand transform it to an acceptable format for Skype for Business.

Situation: HR department begins to create a new user and enters a telephone number in a human readable format.
This string format is governed by a regular expression which permits a plus sign, digits and also spaces.
Ex. "+1 23 456 789". This is written to the AD user object along other inputs and we could go ahead and save this and a working user is created. Btw, this value is also used for email signatures...

However, besides creating an ordinary AD account I want to enable Skype for Business and by the example from Adaxes I use the value reference %telephonenumber% to write the "Line URI:" attribute for the SFB user. The value reference %telephonenumber% contains spaces which is not acceptable value in Line URI.

So how do I transform this from a single entered value to something without spaces for SFB but keep the format including spaces, for the AD User object pleasing for the eye?

Thanks,

Micael

by (100 points)

1 Answer

0 votes
by (277k points)
selected by
Best answer

Hello Micael,

This can be done by storing the phone number without spaces and the plus sign in another property of the user account. For example, you can use the Mobile Phone (LDAP name mobile) property or one of Adaxes custom attributes (e.g. CustomAttributeText1). To automatically save the updated phone number to the corresponding property you will need to use a Business Rule triggering Before Creating a User and a PowerShell script. In the Line URI field of the Enable or disable for Skype for Business (Lync) action, you will need to use the value reference for the property that stores the updated number (e.g. %adm- CustomAttributeText1%). To create the Business Rule:

  1. Launch Adaxes Administration Console.

  2. In the Console Tree, right-click your service node.

  3. In the context menu, navigate to New and click Business Rule.

  4. On step 2 of the Create Business Rule wizard, select User Object type.

  5. Select Before Creating a User and click Next.

  6. Click Add an action.

  7. Select Run a program or PowerShell script.

  8. Paste the below script into the Script field. In the script:

    • $property – specifies the LDAP name of the property that will store the updated phone number;
    • $charactersToReplace – specifies the characters that will be removed from the phone number.
     $property = "adm-CustomAttributeText1" # TODO: modify me
     $charactersToReplace = @("+"," ") # TODO: modify me
    
     if ($Context.IsPropertyModified("telephoneNumber"))
     {
         $telephoneNumber = $Context.GetModifiedPropertyValue("telephoneNumber")
    
         foreach ($character in $charactersToReplace)
         {    
             $telephoneNumber = $telephoneNumber.Replace($character, "")
         }
    
         # Save updated phone number to another property
         $Context.SetModifiedPropertyValue($property, $telephoneNumber)
     }
  9. Enter a short description and click OK.

  10. Click Next and finish creating the Business Rule.

0

That did it. :)
I've added this as a business rule and grouped it with the other cleaning script examples I found here.

Thanks for as swift reply.
Micael

Related questions

0 votes
1 answer

We're needing to add some input masking for values. One such value is a date that must be in the format "YYYY-MM-DD HH:MM:SS" and a phone number that must be "(000) ... 't find one. Any ideas? I appologize if this is already somewhere but I couldn't find it.

asked Mar 15, 2021 by jordan (110 points)
0 votes
1 answer

Hi team, hope you are doing well : ) I looking for a solution to edit multiple users and set attributes based on input. Let me explain: Helpdesk needs to select ... a text string and added to description or several custom attributes. Is this somehow possible?

asked Oct 16, 2023 by wintec01 (1.2k points)
0 votes
1 answer

My situation is we give user's mailbox delagation without automapping somewhat randomly so in the web ui form we would like them to be able to select ad users in the input field

asked Jan 18, 2022 by Keonip (180 points)
0 votes
1 answer

HI *, I would kindly ask if there is a way to pass value to running custom script trough web interface. I see some old discussions on the forum that this feature should be come ... I cannot find it. Could you please help me to find out how to proceed? Thanks.

asked Jan 26, 2015 by majin (50 points)
0 votes
1 answer

I am relatively new, so please be patient if this has already been asked and answered - I have started looking for this information and have not yet found it in this ... patterns based on the values being entered into the form. Is that in any way achievable?

asked Apr 2, 2014 by hms.scott (220 points)
3,411 questions
3,108 answers
7,912 comments
545,843 users