# Open a Perspective popup when a user chooses to create a new dropdown entry

**URL:** <https://forum.inductiveautomation.com/t/open-a-perspective-popup-when-a-user-chooses-to-create-a-new-dropdown-entry/80449>\
**Category:** Ignition\
**Tags:** perspective, scripting\
**Created:** [October 13, 2023, 1:55pm UTC](https://forum.inductiveautomation.com/t/open-a-perspective-popup-when-a-user-chooses-to-create-a-new-dropdown-entry/80449 "2023-10-13T13:55:12Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![bmeyers](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/bmeyers/32/37453_2.png) [@bmeyers](https://forum.inductiveautomation.com/u/bmeyers)\
**Post date:** [October 13, 2023, 1:55pm UTC](https://forum.inductiveautomation.com/t/open-a-perspective-popup-when-a-user-chooses-to-create-a-new-dropdown-entry/80449/1 "2023-10-13T13:55:12Z")

</div>

I have a dropdown component with custom entry selected. If the user creates a custom entry I want to immediately open a popup window. Is there a natural way to accomplish this in Perspective?

![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/c/5/c504b620ea51ba1e3fb5d042ed312bc2c7ee12d0.png)

I think I could accomplish this by comparing the value property against the options property and determining this is a new entry but I wanted to confirm I wasn't missing a more obvious path.

Thanks for an input.

---

<div class="post-metadata">

**Author:** ![cmallonee](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/cmallonee/32/6416_2.png) [@cmallonee](https://forum.inductiveautomation.com/u/cmallonee)\
**Post date:** [October 13, 2023, 2:34pm UTC](https://forum.inductiveautomation.com/t/open-a-perspective-popup-when-a-user-chooses-to-create-a-new-dropdown-entry/80449/2 "2023-10-13T14:34:42Z")

</div>

> [@bmeyers](#):
>
> I think I could accomplish this by comparing the value property against the options property and determining this is a new entry

I do think this is the best way, but keep in mind that the Popup won't be opened until _after_ the new value has been applied; if you're looking to require confirmation before creating the new option, you'd be better served having something akin to a `+` icon next to the Dropdown where clicking the icon opens a Popup which acts as a confirmation while (temporarily) injecting the new option into the options of the Dropdown.

---

<div class="post-metadata">

**Author:** ![bmeyers](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/bmeyers/32/37453_2.png) [@bmeyers](https://forum.inductiveautomation.com/u/bmeyers)\
**Post date:** [October 13, 2023, 2:40pm UTC](https://forum.inductiveautomation.com/t/open-a-perspective-popup-when-a-user-chooses-to-create-a-new-dropdown-entry/80449/3 "2023-10-13T14:40:57Z")

</div>

I think I can make it work in my case. There is another button where they confirm the entry of the entire page. This dropdown popup is basically to update some database table entries to make sure the final submit button completes successfully.

Thanks for the verification. I'll post my code to do it shortly.

---

<div class="post-metadata">

**Author:** ![bmeyers](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/bmeyers/32/37453_2.png) [@bmeyers](https://forum.inductiveautomation.com/u/bmeyers)\
**Post date:** [October 13, 2023, 4:04pm UTC](https://forum.inductiveautomation.com/t/open-a-perspective-popup-when-a-user-chooses-to-create-a-new-dropdown-entry/80449/4 "2023-10-13T16:04:38Z")

</div>

Working code:

```auto
ds = self.props.options
	
for row in range(ds.getRowCount()):
	TaskTemplateName = ds.getValueAt(row, 'TaskTemplateName')
		
	if TaskTemplateName == currentValue.value:
		# Entry already exists
		pass
	else:
		# Open popup so user can add new entry to system.
		system.perspective.openPopup('xyz', 'facility/addTask/newTask', params = {'TaskTemplateName' : currentValue.value}, modal = True)
```

I put this code in a Change Script on the dropdown value property. I read in the options dataset and compare my currentValue against the dataset values (dataset has a column called TaskTemplateName). If the entry isn't found in the dataset I pass a parameter called TaskTemplateName with the currentValue into the popup where the user can create a new TaskTemplate.
