How to update object attribute values using automation in JSM Assets

お困りですか?

アトラシアン コミュニティをご利用ください。

コミュニティに質問

 

プラットフォームについて: Cloud のみ - この記事は、 クラウド プラットフォームのアトラシアン製品にのみ適用されます。

   

要約

Refer to the below examples to understand how you can update the object attributes using Automation smart values and functions. 

環境

Automation for Jira and JSM asset management 

ソリューション


Example 1: Calculate the Used and Available License count
Let's assume we have a License object type that has a user type attribute Assigned and 3 integer attributes Total, Used, and Available. Now when an admin creates a License type object they will mention the total number of licenses available and select the users to whom the license is assigned. 
 


Based on the number of licenses assigned to users, we can calculate the available and used license count automatically:

  1. From the Global admin page of automation, create a rule that triggers when an object is Created or Updated 
  2. Next, add the "Edit object" action to update the Used and Available attributes with the below smart values:
    Used

    {{object.Assigned.size}}

    Available

    {{#=}}{{object.Total}} - {{object.Assigned.size}}{{/}}




Example 2: Calculate the end of Warranty date  
Let's assume there is an objecttype Laptop with date attributes Warranty startDate, Warranty endDate, and integer attribute Warranty that contains the number of months for which the warranty is provided. These objects are created with the Warranty startDate attribute and the Warranty attribute.


Based on the Warranty date and number of months, we can calculate the Warranty end date:

  1. From the Global admin page of automation, create a rule that triggers when an object is Created or Updated 
  2. Add an action Create variable to create variable datevar
    Due to the bug JSDCLOUD-10177 we cannot use the automation functions on the object attributes at this time, so we will use a variable to copy the date attribute, we can then apply the automation functions on it:

    {{object.Warranty startDate}}
  3. Add an action Create variable to create variable months
    Due to the missing feature AUT-1473 we cannot use a smart value inside the date.plusMonths() function

    {{object.Warranty}}
  4. Next, add the "Edit object" action to update the Warranty endDate attribute with the below smart value:

    {{datevar.toDate.plusMonths(months.asNumber)}}

tip/resting Created with Sketch.

Additional tip

While we wait for bug JSDCLOUD-10177 to be fixed, If you want to calculate the difference between an object date field and today when an object is updated, then use the below steps after the object updated trigger is added:

  • Create variable datevar1 to save the smartvalue {{object.Warranty startdate}}
  • Create variable datevar2 to save the smartvalue {{datevar1.toDate.jqlDate}}
  • Then use the below smart value to find the difference between Warranty startdate and today:
   {{datevar2.toDate.diff(now).days}} OR 
   {{now.diff(datevar2.toDate).days}} OR 
   {{datevar2.toDate.diff(now).days.abs}}

For more information refer to Examples of using smart values with dates


Example 3: Update the object status to Expired after the License Expiry
Refer to the article How to update object status to expired using automation in Assets

Example 4: Auto-populate approvers from Asset objects
Refer to the article How to auto-populate approvers from Asset objects attributes using automation in Assets

Example 5: Copy/add list of objects to a reference Asset object attribute using Automation
Refer to the article How to copy or add list of Assets object to a reference Assets object attribute using Automation in Assets

Example 6: Append list of objects to a reference Asset object attribute using Automation
Refer to the article How to append list of objects to a reference Assets object attribute using Automation


最終更新日: 2024 年 1 月 29 日

この内容はお役に立ちましたか?

はい
いいえ
この記事についてのフィードバックを送信する
Powered by Confluence and Scroll Viewport.