The most commonly used script would look something like this:
Set Variable [$RequestID ; value: Requests::__pkRequestID ]
Go To Layout ["Requests_Declined" ( Requests_Declined ) ]
Set Field [Requests_Declined::_fkAgencyID ; $$CurrentAgencyID ]
Set Field [Requests_Decliened::_fkRequestID ; $RequestID ]
Go to Layout [original layout ]
But this only creates the new record. You would still need to have the user enter the text describing the reason (or select the reason from a value list.) This could be done with a global field before this script is run and then there is a third set field script step.
Or you can do this without any script if you add a portal to Requests_Declined right on your Requests layout with a relationship that has the "allow creation of records via this relationship" option enabled. The use can create the record automatically by entering a reason into the field in the portal row. (And if you only need to log a single reason, you don't even need the portal, you can just put the field directly on the layout.)
Okay, I've managed to do this although preferably I'd like to use a Custom Dialog with a dropdown list for data consistency and have a value list defined for the global value to be set.
In a previous thread (http://forums.filemaker.com/posts/cd2729767e) we talked about only showing requests that had no agency id associated to it. If a specific agency declines a request how can I filter the same list view so that they cannot see the request any more..
I'd like to use a Custom Dialog with a dropdown list
This is not possible in FileMaker. What IS possible is to use either a custom layout with the New Window step to open a new modal window for this, or you can put the dropdown list field inside a popover button if you are using FileMaker 13 or newer. I find the popover a simpler options to implement--especially on windows systems.
A list can be a set of records in a list view, a set of records displayed in a portal or a value list--which can be a conditional value that only displays data from a specified table from records that match specified criteria....
I originally read your "drop down list" as a drop down list of reasons for denying a request. But if you want a drop down list of Requests where an agency ID field in the same table is empty, then what I call a "hardwired conditional value list" can do that. See the example of that name in:
Managed to get this working quite nicely, I created a popover which stores a global value field which is also a dropdown. The popover has a submit button that goes to requests declined layout and fills appropriate fields. Thanks