Catalog Field for Multiple Cloud vCenter

Hi,

I have multiple vcenter integrated to morpheus, and i made a catalog form so user able to choose which vcenter that they want to placed the instance. Also i have different policy name for each vcenter, let say if VM deployed to VCSA1 then hostname/vmname should be named with prefix VC1xxx, and if VM goes to VCSA2, then hostname/vmname should be named with prefix VC2xxx.

VCSA1 cloud ID is 12, and VCSA2 cloud ID is 15, so i made the catalog condition for hostname and vmname as this below code.

“name”: “<%=if (customOptions.cloudname == 12 ){‘VC1’} else {‘VC2’}%><%=customOptions.hostname.toUpperCase()%>”,
“hostName”: “<%=if (customOptions.cloudname == 12 ){‘VC1’} else {‘VC2’}%><%=customOptions.hostname.toUpperCase()%>”,

In form catalog, field for cloud option have 2 lists in dropdown/select list, VCSA1 and VCSA2. When i go to this catalog is VCSA1, and submitted it, it was works as name format expected that use VC1xxx, also if i choose VCSA2, it was works as expected too using VC2xxx,
BUT when i choose VCSA2, then going back to choose VCSA1, the name still using VC2 which is used by VCSA2, it supposed to using VC1xxx.

Please help if there something i missed to make it happen

If you inspect the page in chrome, when on the network tab you should see a ‘price’ object when making changes assuming pricing is on. Select that and then choose payload. Inspect the payload to see if the value is actu ally changing.

Also, do you have a ‘select’ option in your list? or only the 2 values? You may need to evaluate your variables like:

customOptions?.cloudname the ? tells groovy to only evaluate if the value exists.

I just using “cloud” type for this field. and when i use check the element as your advice before, i tried to change the cloud list in form catalog to VCSA2 and reverse to VCSA1, but in network tabs, only price was generated new one, for cloud, there’s nothing changed.