Hi hkui,
Take a look at the actions for the onClosePopUp event of the New Activity screen. There is conditional handling here to auto-populate the Contact dropdown with a Shared Result, if there is a Shared Result returned from the Search Contacts List pop-up. See below:
We can see from these actions that if the last pop-up was Search Contacts List and it's returning a Shared Result, that Shared Result will be entered into the Contact dropdown on screen. The Contact dropdown's Text Change event is then called, which grabs that Contact's information from the Contacts table and populates it to the appropriate controls on screen. For this to work properly the Shared Result is cleared before the above statements, to ensure that we can accurately test whether or not a value is being returned.
You can use a similar model for your New and/or Edit buttons on your custom screen. By returning a newly created opportunity's RecordID you can auto-populate your dropdown with its value, based on conditional statements. This is the model Method stock screens use, so it's generally a good model to follow to ensure proper functionality.
Let me know how it goes.
- Justin