- Community Home
- >
- Software
- >
- HPE Morpheus Software
- >
- HPE Morpheus Enterprise
- >
- Re: Use Tenant ID in translation script or request...
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-11-2024 03:22 AM
11-11-2024 03:22 AM
Use Tenant ID in translation script or request script for rest option
Hi, I have an option list created with a REST call to ServiceNow. I need to filter the values returned on the tenantId base. I have two ways, create a dynamic rest call changing the query parameter or querying all the data and filtering them in morpheus using the translation script. In both cases I need to access the current tenantId value but it seems no possible. Is there any solution to this? Thanks
- Tags:
- option-lists
- Options

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-11-2024 03:29 AM
11-11-2024 03:29 AM
Re: Use Tenant ID in translation script or request script for rest option
you can obtain the current tenant/account id in the translation script with the following variable:
input.accountId; //accountId is builtin variable so you are not required to create this input in the UI
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-12-2024 10:33 AM
11-12-2024 10:33 AM
Re: Use Tenant ID in translation script or request script for rest option
Are you trying to pass accountId of the current executing user to filter the list? Or view the accountId value from your REST call? You seem to have merged the two concepts together.
Seems like you want to add a where
argument in your translation script to filter based on the current user’s accountId. Instead you are trying to hardcode the user’s tenantId as the name value for all options. Or in a Request script you can filter the payload prior to the return similar to this thread.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-13-2024 12:09 AM
11-13-2024 12:09 AM
Re: Use Tenant ID in translation script or request script for rest option
Hi, I am trying to filter the result on the tenantID of the current user. I changed The translation script in this way:
results = ;
for (let i=0; i < data.result.length; i++){
if (data.result[i].u_tenant_morpheus == input.accountId) {
results.push({name: data.result[i].name, value:data.result[i].u_tenant_morpheus});
}}
but it returns no rows
But if I change it inserting a static string like this
results = ;
for (let i=0; i < data.result.length; i++){
if (data.result[i].u_tenant_morpheus == “2”) {
results.push({name: data.result[i].name, value:data.result[i].u_tenant_morpheus});
}}
it returns the expected rows.
In the image I assigned the value of input.accountId to the name of the option list to see if it was correctly read.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-13-2024 07:19 AM
11-13-2024 07:19 AM
Re: Use Tenant ID in translation script or request script for rest option
I have solved using this:
results = ;
for (let i=0; i < data.result.length; i++){
if (data.result[i].u_tenant_morpheus) {
if (data.result[i].u_tenant_morpheus == input.accountId) {
results.push({name:data.result[i].name, value:data.result[i].name});
}}}
and setting the flag “real time” in rest options

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-11-2024 06:35 AM
11-11-2024 06:35 AM
Re: Use Tenant ID in translation script or request script for rest option
Hi wabbas, I tried it but it seem not to work, This is the code in translation script:
results = ;
for (let i=0; i < data.result.length; i++){
results.push({name: String(input.accountId), value:data.result[i].name})
}
I put accountId in name to see the value but I obtain an undefined value