0 votes

I would like to query the "Account Expires" field and output it as the default entry in description but I prefer the format Jun 7 2013 and not 06/07/13.

There are just too many ways to understand 06/07/13 with staff from every imaginable country.

Any ideas?

by (280 points)

1 Answer

0 votes
by (215k points)

Hello,

This can be easily done with PowerShell scripts. You can create a PowerShell script that updates a user's description with the expiration date of the user's account and add the script to a Custom Command, Scheduled Task or Business Rule with the help of the Run a program or PowerShell script action.

For example, if you want to set the value of the Account Expires property as the default description for all newly created users:

  1. Create a new Business Rule.

  2. On the 2nd step of the Create Business Rule action, select User and After Creating a User.

  3. On the 3rd step, add the Run a program or PowerShell script action and paste the following script in the Script field:

     $dateConversionFormat = "MMM d yyyy" # TODO: Modify me
    
     $accountExpires = $Context.TargetObject.Get("accountExpires")
     if ($accountExpires -eq 9223372036854775807)
     {
         $Context.TargetObject.Put("Description", "Account never expires")
     }
     else
     {
         $expirationDate = $Context.TargetObject.AccountExpirationDate.ToString($dateConversionFormat)
         $Context.TargetObject.Put("Description", "Account expires on $expirationDate")
     }
    
     $Context.TargetObject.SetInfo()
    
  4. In the script, $dateConversionFormat specifies how the date should be converted into a string. For information on how you can specify different date conversion formats, see the Custom Date and Time Format Strings article by Microsoft.

  5. When done with the script, finish creation of the Business Rule.

Related questions

0 votes
1 answer

Hi, Following an update from Adaxes 2016 to 2021.1 we noticed that the date format on the email notifications is no longer English UK, but English US, i.e. ... every scheduled task/business rule that sends a notification and changing the variable? Thanks, Gary

asked 3 days ago by gazoco (430 points)
0 votes
1 answer

Is it possible to change the date format to UK style when using attributes in email messages? For example I am using %adm-CustomAttributeDate1% as a placeholder for a users start ... time being left it there if there isn't a way around it. Kind Regards Danny

asked Jun 1, 2015 by dannyd (200 points)
+1 vote
1 answer

Is there any way to change the format of the email sent to users when they need to approve something? We would like to customize the message and make it look more like what they expect to see from our internal security group.

asked Mar 11, 2013 by DFassett (710 points)
0 votes
0 answers

The language of Adaxes Web interface and the format used to display dates can be different depending on the signed in user. The language can be selected either automatically or ... default formats are: en-US for English, fr for French, and de for German.

asked Feb 10, 2021 by Adaxes (380 points)
0 votes
1 answer

Hi, I was just wondering if there was a way to force the format of the date picker value in the web approval interface. We have operation that are very time specific ... like that in the web interface. Example of the problem: Thank you, Jean-Simon Tremblay

asked Dec 3, 2021 by jsimon.tremblay (20 points)
2,801 questions
2,535 answers
6,605 comments
61,643 users