Filtering the domain using the option list in Service Catalogue

I’m trying the create a service catalogue which will create an instance with user inputs provided. I’ve a network created under Infrastructure > network with all the IP range and domain populated to it. I’ve created a field in service catalogue to allow the user to select the respective network required for the VM creation. Similarly i’m trying to allow the user to select the domain in the list of domains available in the networks.
I’m able to filter all the networks but unable to get the domain list.
Appreciate your response.

You can use the REST API option list to filter the domain list. To do that, you can use the API endpoints below.

Get all Network Domains: Get all Network Domains

Get a Specific Network Domain: Get a Specific Network Domain

Hi @dgaharwar , Thanks for the response. I would like fetch this as part of the Option list and input to use it as part of my Service Catalogue.

You can create a REST option list with source url being the api endpoint and Translation Script something like this: Screen Shot 2024-09-09 at 9.35.34 AM.png - Droplr

@Baba_Dudekula if you are looking to list domains in an option list, currently you must create a REST type Option List.

Source URL: https:///api/networks/domains
Credentials: oAuth 2.0

  • Name
  • Access Token URL: https:///oauth/token
  • Client ID: morph-api
  • Username
  • Password
  • Scope: Write
  • Client Auth: Send as Basic Auth Header

Translation Script:

for (let x = 0; x < data.networkDomains.length; x++) {
    let domain = data.networkDomains[x].active;
    if (domain === true) { // Only show active domains
        results.push({
            name: data.networkDomains[x].displayName || data.networkDomains[x].name,
            value: data.networkDomains[x].id
        });
    }
}

After you create the REST Option List, in catalog you can choose your Option List for a Type Ahead or Select List type field.

Thank you @dgaharwar and @cbunge . I’m able to list the domains.
My scenario is I’ve a network created with the domain and few of the network configuration under Infrastructure> networks.
This network has a domain already allocated.
So my service catalogue should function in a way when i select the respective network the next domain field should get automatically get populated with the domain which is already configured in the network.
This is the use case i’m trying to implement.

If you have the domain already associated to the network, there should not be a need to also populate and pass a domain selection. Are you just trying to informationally show the user which domain it will land on?

Hi @cbunge , Yes the reason I’m trying to do this is i have few domains configured for few networks. The network selection is working fine when triggered via catalogue and are reflecting in the VM. But the domain is not reflecting correctly what ever the network is the domain is remaining constant across all the networks.
So i’m trying to do this exercise here.

If you want to use the option list you created, you will need to update the catalog config with the custom option you created (if you haven’t already).

For example:
image

If you want the domain to be selected based set on the network, all you should have to do is select “use default” under advanced options when you go to configure the catalog item.

Hope this helps :slight_smile:

@Tyler_Boyd Yes. I identified where the issue is coming from. It’s the network that is getting hard coded for some reason even though it is referenced with custom Option in the network configuration.

"networkInterfaces": [
  {
   "primaryInterface": true,
   "network": {
    "id": "network-42",
    "hasPool": true,
    "idName": "<%=customOptions.vsphere_network%>",
    "pool": {
     "id": 3,
     "name": "at-dtf Network Pool"
    }
   },
   "ipMode": "static",
   "showNetworkPoolLabel": false,
   "showNetworkDhcpLabel": false,
   "ipAddress": "<%=customOptions.vm_ipaddress%>",
   "ipAddressName": "",
   "displayName": ""
  }
 ],

But the network selection is still not parameterized. even