In my Asset Management feature, I am planning to create an Automation using Python. These are the details of the goal:
1. In my Asset Management System, there are couple Object Schemas. If click any of those schemas, there is Schema Tree, and in this Schema Tree, there is this section called "Users".
2. In this "User" section, I can select any Users, and there is a custom attribute that was created and it is called "JiraUser". The goal is, to validate the email address of the user whether the user can be found in the Asset. If the user is found, then automatically update the custom attribute field "JiraUser" with the name of the user that is found.
I have not found a solution to tackle this situation, therefore seeking help to put me in the right path to achieve this goal. This is an example python script that I have created ( could be your reference if there is something to be chnaged):
Not sure Python automation for Jira Asset Management is possible or not, but any help will be very much appreicated. Thanks!
You could use the atlassian library: https://atlassian-python-api.readthedocs.io/index.html
Which also includes JSM api: https://atlassian-python-api.readthedocs.io/service_desk.html
If you want to query assets, you could use the assets.py from my github repo.
Just have another question to clarify -> the assets.py from your github repo is a script in general to connect to the assets section, amd I right ? Since I am specifically targetting the "JiraUser" attribute in the asset management of "Users", how can I achieve this with the asset.py script from your repo ?
Thanks for your time and feeback, appreciate it.
Thanks,
Parvin
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Yes, you can connect to Assets in Jira, e.g get all User objects and get all atributes of each object. Here a little example of printing your users names and the jiraUser attributes. Note that you need to change the credentials and maybe the attribute names.
from assets import assetsConnect
sitename = "https://mysite.atlassian.net"
username = "myusername@mycompany.com"
apiToken = "S3cR3t"
# Connect to assets
myAssets = assetsConnect(siteName, username, apiToken)
allUserObjects = myAssets.getObjects('objectType = User')
for userObject in allUserObjects:
data = myAssets.getObjectData(userObject)
print(f"{data.get('Name')} - {data.get('jiraUser')}")
Good luck,
Rudy
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.