Assets objects versioning
Asked by Ksenia Abdulina:

Hi there!

Is there any way to have objects versions in Assets? There is a history log of changes made to an object but there is no "revert to previous version" function or even object version term.

What I can think of is an attribute with at least version number but there's no chance to compare two incremental changes of an object.

Any thoughts?


Answers:
author: Kai Becker
body: Hi [@Ksenia Abdulina](/t5/user/viewprofilepage/user-id/3930444)

thank you for your question.

AFAIK there is no solution to your problem I can imagine.  
Assets does not allow to compare two versions, neither does Jira for Issues in terms of history.

comments: author: Ksenia Abdulina
body: Hi [@Kai Becker](/t5/user/viewprofilepage/user-id/1178079)

I just wonder if that just isn't the right way to use Assets?

For example, I have Assets Object Schema with all my company servers with theirs parameters, such as CPU, RAM, Disks etc. I've built a process that update my server object using fields from Jira issue. So in Service desk portal I have a request type "Change server parameters". Using SR I update assets attribute values in cmdb. But then, I need to revert changes from previous request. For now I can do so by simply look at the history log and edit values manualy. If I have more than one issue affected my object it has become more difficult to understand what values should I revert exactly.

Anyway, my current idea is to create a csv file attached to the object where I can store changes from each issue. Hope this solution will help anybody else.


author: Kai Becker
body: Hi [@Ksenia Abdulina](/t5/user/viewprofilepage/user-id/3930444)

thanks for updating on your question.

There might be something that could make your life easier.   
What about writing the current state of the object into the JSM issue, after updating values?  
You could use an Automation rule, that reads the attributes and write a comment to the issue.  
You could then use the object view to take a look at the connected issues and see the changes. Hope this helps.


author: Ksenia Abdulina
body: Hi [@Kai Becker](/t5/user/viewprofilepage/user-id/1178079)

The list of connected issues are great but there's no chance to see what attributes were updated by specific connected issue **from an object view**. E.g. if in history log there is a line like

UserMadeChange: 'CPU' changed from '2' to '4', source 'KEY-N'

that would be kind of a solution.


author: Kai Becker
body: Hi [@Ksenia Abdulina](/t5/user/viewprofilepage/user-id/3930444)

this is not an out of the box solution, but you could build this by yourself using Automation.

I guess you are updating object details via Automation, so after that you need to gather the relevant data and write a comment to the object. I have not done this by myself, but here are some things to get you started:

* get the change history of an object (it stores old and new value) <https://developer.atlassian.com/cloud/assets/rest/api-group-object/#api-object-id-history-get>
* Check this thread for a way to add a comment to an object: <https://community.atlassian.com/t5/Automation-questions/Action-to-comment-objects/qaq-p/2286947#M9355>

The rule would be setup as follows:

1. Issue created trigger
2. conditions to check stuff
3. action to edit object
4. web request to get change history
5. web request to write comment to object containing the old and new value and {{issue.key}} as a reference

Hope this helps to get you started.


author: Ksenia Abdulina
body: Hi [@Kai Becker](/t5/user/viewprofilepage/user-id/1178079)

As I have not the latest JSM version, I use ScriptRunner Script within workflow PostFunction. But your proposal to add comment to the object is great, as I can show incremental changes there. It would be really great if I can show those comments through "Search for objects" in columns. Did I understand right that this is not standard field and I cannot add Comments as columns for further export?


author: Kai Becker
body: Hi [@Ksenia Abdulina](/t5/user/viewprofilepage/user-id/3930444)

sorry, I posted some links that are rather cloud focused, but the solution should also work for Server, but with different URLs and modified Automation rule.

Regarding the search and export you are right. It is not possible to export this.   
But you could also add another attribute to the objects for the history and write the change to this specific attribute instead of a comment. This way it would be exportable.


Tags: assets

jira-service-desk-server

jira-service-management

jira-service-management-server