Validation scripts - get the name of the asset to check
Hello,
i need to make an asset validation rule that checks the name of the asset (naming convention).
I am using 5.7.9-2 version (on premises)
I have tried many solutions :
asset_names = attributes.‘00000000-0000-0000-0001-000500000032’ (i am not sure about this resource id)
asset_names = attributes.‘Name’
asset_names = attributes.‘name’
asset_names = attributes.‘Full Name’
asset_names = attributes.‘Full name’
asset_names = attributes.‘full name’
Every time I get ‘null’
Can you please help ? What is the good way to get the name of an asset and perform a test on it ?
Thanks a lot, François
francoisabraham
Posted 5 years ago · Edited 1 year ago·Last reply 5 years ago
2 comments
francoisabraham
OP5 years ago · EditedOK thanks a lot : so to get the name of the asset you only need to write ‘name’ : quite simple
Regards
noor
·5 years ago · EditedExample from page#235 of the admin guide:
An asset must comply to the following naming rule, defined by a regular expression:
starts with T, followed by 4 digits, 2 zeroes and exactly one 0, 1 or 2.
rule {
matches (name, /T(\d{4})0{2}[0,1,2]/,
message: “Asset ${name} does not comply to naming rule”)
}