Am trying to figure out a way to hide a paragraph for assets. The case is that a customer wants to add secret instructions over how to use certain assets.
On this image I want to try to hide the “Secret Paragraph” as this should only be displayed to a certain group witihin the workspace?
Hi @Ansfs91. May have to think a bit out of the box. “Secret” from whom? Who shouldn’t see the data in FS? Data could be stored in the app, a KB, or externally and just associated with the asset and manage your CRUD.
Hi @Ansfs91. Looking at the link to the other thread to get more context, this is possible today. The custom fields are known as Type Fields in Assets. If we create a custom field under the Computer layer:
The fields are named with the layer id, which can be queried here or via the URL. These layers and ID are unique to each instance, so these steps will need to reproduced in the instance you are developing for. To confirm the field, start by using the Get Asset Type endpoint and then fields can be retrieved for that layer (example using the FreshservicePS Powershell module):
Then we just need to set the Type Fields on the asset:
PS C:\Build> Set-FSAsset -id 3674 -type_fields @{secret_squirrel_21000855272 = 'This is a test of the secret squirrel network'} -Verbose
VERBOSE: Processing body parameter type_fields
VERBOSE: Performing the operation "Set-FreshServiceAsset" on target "https://its-fine.freshservice.com/api/v2/assets/3674".
VERBOSE: Appending Authorization header
VERBOSE: Invoke-FreshworksRestMethod - Initiating REST API call to https://its-fine.freshservice.com/api/v2/assets/3674 with API key: XXX
VERBOSE: Invoke-FreshworksRestMethod - REST call parameters:
VERBOSE: Invoke-FreshworksRestMethod - Uri: https://its-fine.freshservice.com/api/v2/assets/3674
VERBOSE: Invoke-FreshworksRestMethod - Body: {
"type_fields": {
"secret_squirrel_21000855272": "This is a test of the secret squirrel network"
}
}
VERBOSE: Invoke-FreshworksRestMethod - ErrorAction: Stop
VERBOSE: Invoke-FreshworksRestMethod - ContentType: application/json; charset=utf-8
VERBOSE: Invoke-FreshworksRestMethod - Headers:
VERBOSE: Invoke-FreshworksRestMethod - Authorization: Basic XXX
VERBOSE: Invoke-FreshworksRestMethod - Accept-Charset: utf-8
VERBOSE: Invoke-FreshworksRestMethod - Method: PUT
VERBOSE: Invoke-FreshworksRestMethod - UseBasicParsing: True
VERBOSE: Invoke-FreshworksRestMethod - Invoking REST PUT Method on https://its-fine.freshservice.com/api/v2/assets/3674...
VERBOSE: Invoke-FreshworksRestMethod - Forcing TLS 1.2 protocol for invoking REST method.
VERBOSE: Requested HTTP/1.1 PUT with 113-byte payload
VERBOSE: Received HTTP/1.1 response of content type application/json of unknown size
VERBOSE: Returned status OK with code 200.
VERBOSE: Current FreshService minute rate limit is 160 with 159 calls remaining (0.62% used) .
VERBOSE: Invoke-FreshworksRestMethod - Completed REST PUT Method on https://its-fine.freshservice.com/api/v2/assets/3674 in 00:00:00.6625268.
VERBOSE: Returning asset property with count 1
attachments : {}
cloud_files : {}
type_fields : @{product_21000855267=21000056898; vendor_21000855267=; cost_21000855267=; warranty_21000855267=; acquisition_date_21000855267=; warranty_expiry_date_21000855267=; domain_21000855267=; asset_state_21000855267=In Use; serial_number_21000855267=; last_audit_date_21000855267=; os_21000855272=; os_version_21000855272=; os_service_pack_21000855272=; memory_21000855272=; disk_space_21000855272=;
cpu_speed_21000855272=; cpu_core_count_21000855272=; mac_address_21000855272=; uuid_21000855272=; hostname_21000855272=; computer_ip_address_21000855272=; last_login_by_21000855272=; dp_location_21000855272=; secret_squirrel_21000855272=This is a test of the secret squirrel network; depreciation_id=; salvage=}
name : Laptop9999
asset_type_id : 21000855304
asset_tag : 9999
impact : low
description : Apple Laptop
end_of_life :
discovery_enabled : True
usage_type : permanent
created_at : 6/23/2023 5:15:05 PM
updated_at : 1/2/2024 4:34:05 PM
location_id :
department_id :
agent_id :
user_id :
group_id :
assigned_on :
workspace_id : 3
author_type : User
id : 21001910978
display_id : 3674
Keep in mind, another gotcha is that to retrieve type fieldsof an Asset object, it costs additional API calls (see Note 4 here: Service Desk API for Developers | Freshservice. Unfortunately, we cannot change the base Asset object, so you have to create custom fields in the layers and pay penance for getting the data.
Hence we are not able to update the fields (e.g. a password a printer, lock combination for a facility) for the secret group. So we are not able to continue with this project.