- Community Home
- >
- Software
- >
- HPE Morpheus Software
- >
- HPE Morpheus Enterprise
- >
- Translation script with Manual Optionlist
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
06-21-2023 02:39 AM
06-21-2023 02:39 AM
Translation script with Manual Optionlist
Hi,
I’m trying create an option list which contains a list of ids for vmwareFolderId
Currently we have 5 vcentres which contain the same VMware Folder, but the ID is different.
Ideally I would like to add some logic so depending on what cloud has been selected then the required Vmware folder is chosen.
Apart from allowing an input for the end user to select from a list, I have not managed to get it work.
I don’t think setting VMware folders via the Morpheus GUI for each tenant is right, I have also tried to create individual inputs with the same fieldname, hidden it and set a default value, adding the custom options entry to config but get this error:
failed to create server: class java.util.ArrayList cannot be cast to class java.lang.String (java.util.ArrayList and java.lang.String are in module java.base of loader ‘bootstrap’)
I have tried to create an if statement ie if selectedcloud = devvcentre 1 push results and devcentre 2 push x results. But my if statement logic is not correct, and it just lists both items regardless of what cloud I have selected.
Any help appreciated?
- Tags:
- option-lists
- Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-22-2023 12:51 AM
06-22-2023 12:51 AM
Re: Translation script with Manual Optionlist
I have added input, however I don’t think the IF statement is correct as both are shown instead of one:
if (input.selectedCloud = (‘Devcenter1’))
{
results.push({name:data[0].name, value:data[0].value});
}
if (input.selectedCloud = (‘Devcenter2’))
{
results.push({name:data[1].name, value:data[1].value});
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-22-2023 01:53 AM
06-22-2023 01:53 AM
Re: Translation script with Manual Optionlist
Hi Chopper,
Please try replacing the if condition statement with == operator .
if (input.selectedCloud == (‘Devcenter1’))
{
results.push({name:data[0].name, value:data[0].value});
}
if (input.selectedCloud == (‘Devcenter2’))
{
results.push({name:data[1].name, value:data[1].value});
}
Thanks
Mousami
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-22-2023 07:55 AM
06-22-2023 07:55 AM
Re: Translation script with Manual Optionlist
To troubleshoot this may be first try to print input.selectedCloud and verify that you are getting the expected value.
console.log(input.selectedCloud)
I can see in the first screenshot the value used in if statement is ‘DEVVcenter1’ and in the second post different string is used in if statement ‘Devcenter1’.
Thanks
Mousami
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-23-2023 06:59 AM
06-23-2023 06:59 AM
Re: Translation script with Manual Optionlist
6.0.2 LTS version
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-22-2023 08:45 AM
06-22-2023 08:45 AM
Re: Translation script with Manual Optionlist
Thanks, I have sanitised the content. So those are not the exact vcentres listed.
I presume the console log is within the appliance?
I have looked at the content from chrome developer tools to spot what is being selected, so I’m hoping it would be the same.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-21-2023 02:28 PM
06-21-2023 02:28 PM
Re: Translation script with Manual Optionlist
It’s hard to pick out from the screen grab, but I think you’re going to need dependent inputs. So, one gets chosen and that triggers the next to update, and run it’s translation script, which gives you the filtered output.
You can grab the value of a previous input using “input.{fieldname}” type syntax, which will give you a value you can then use in the if statement I can see.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-22-2023 07:02 AM
06-22-2023 07:02 AM
Re: Translation script with Manual Optionlist
Thanks.
Tried that and when I change from = to == the size goes to 0 for the results.
if I leave it just = only devcenter1 appears in the list regardless. If I enter something random in like if (input.selectedCloud == (‘xxxx’))it still triggers the push.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-23-2023 08:13 AM
06-23-2023 08:13 AM
Re: Translation script with Manual Optionlist
Got it working.
I did not have real-time selected:
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-22-2023 09:12 AM
06-22-2023 09:12 AM
Re: Translation script with Manual Optionlist
Quick question. Are you on the 6.1.x branch of Morpheus or plan on upgrading to the 6.2.0 branch next month? We will be introducing a VMware folder select list within the form build to make this more native.