In the Strategy WorkStation, users who are enabled might not have email addresses assigned to them, which can impede communication and notification processes. Manually adding email addresses for each user can be time-consuming and prone to errors.
The necessity for this script arises from the presence of enabled users in the Strategy environment who do not have an email address associated with their account, possibly due to manual user creation.
To automate the process of adding email addresses to new users, follow these steps in the Strategy WorkStation:
1. Connect to Your Environment: Initialize the connection to your Strategy environment.
2. Navigate to Administration: Access the administration panel to manage scripts and workflows.
3. Access Scripts Section: Go to the scripts section where you can create or modify scripts.
4. Select Your Environment: Choose the appropriate environment where the script will be executed.
5. Open Gallery Tab: In the right section of the interface, select the Gallery tab to view available workflows and scripts.
6. Expand Administration Workflows: Find and expand the Administration Workflows section to access various administrative scripts.
7. Launch 'Add Email to New Users' Script: Double-click on the 'add email to new users' script to open it.
8. Execute the Script: Hit the run button to execute the script and automatically add email addresses to new users.
Strategy Workstation Interface
Here is the python script that can be found find within Strategy WorkStation
"""Add email address with a form `{username}@Strategy.com` to every user
which is enabled but doesn't have an email address. For each successfully added
email address a message will be printed.
"""
from typing import List
from mstrio.connection import Connection, get_connection
from mstrio.users_and_groups import list_users, User
def add_email_to_new_users(connection: "Connection", domain="Strategy.com") -> List["User"]:
"""Add email address with a form `{username}@Strategy.com`
to every user which is enabled but doesn't have an email address.
For each successfully added email address a message will be printed.
Args:
connection: Strategy connection object returned by
`connection.Connection()`
domain: name of the domain in the email address (it should be
provided without '@' symbol). Default value is "Strategy.com".
Returns:
list of users to which email addresses where added
"""
# get all users that are enabled
all_users = list_users(connection=connection)
users_ = [u for u in all_users if u.enabled]
modified_users_ = []
for user_ in users_:
# add email address only for those users which don't have one
if not user_.addresses:
email_address = user_.username + '@' + domain
user_.add_address(name=user_.username, address=email_address)
modified_users_.append(user_)
return modified_users_
# connect to environment without providing user credentials
# variable `workstationData` is stored within Workstation
conn = get_connection(workstationData, 'Strategy Tutorial')
# execute adding email to new users
# if needed provide some domain - default is 'Strategy.com'
add_email_to_new_users(conn)
Python within Workstation https://www2.microstrategy.com/producthelp/Current/Workstation/en-us/Content/intro_scripts.htm
Preview Python Scripts https://www2.microstrategy.com/producthelp/Current/Workstation/en-us/Content/preview_scripts.htm
mstrio-py https://github.com/MicroStrategy/mstrio-py
https://www2.microstrategy.com/producthelp/Current/Workstation/en-us/Content/intro_scripts.htm
Customization Warning:
This customization is provided as a convenience to Strategy users and is only directly applicable to the version stated. While this code may apply to other releases directly, Strategy Technical Support makes no guarantees that the code provided will apply to any future or previous builds. In the event of a code change in future builds, Strategy Technical Support makes no guarantee that an updated version of this particular customization will be provided. For enhancements to this customization or to incorporate similar functionality into other versions, contact your Account Executive to inquire about Strategy Consulting assistance.