I believe I need to pass the value in the field as a parameter, Get(ScriptParameter) but I am damned if I can figure out how.
You can write the script parameter when choosing the script.
I put the field I want passed into the script parameter section. That will pass the fully qualified name into the script. Then I believe you can do GetField ($Content).
you can simply skip a few steps by putting
GetField (GetFieldName ( YOURTABLE::YourField) ) in the script parameter section. If possible, I'd always commit the record so that the new data is put in the field when the trigger is run. The function Get(ActiveFieldContents) wouldn't work in this case because the record has been committed.
As mentioned I need to use this script on multiple fields so a single script for all would be good.
Just use this same method for every field you want and it will work every time. The parameter still needs to be unique to the field in your case.
Many thanks for your reply. I am not sure I am following you very well.
What should be the actual script step(s) be before I put the Script Parameter in?
I have put GetField(GetFieldName("MyTable::MyFieldName")) as my parameter but I don't see how this would pass the contents of the field to my $$Content variable.
I am not aiming to change any data in the field, I just want to capture the existing data into the $$Content variable.
The other thing is that the script still only fires after data is selected from the drop-down menu is selected, which is too late to capture the existing data before it may be changed.
Forgive me if I am being slow.
Sorry, my fault, I left out the GetScriptParameter in my script step.
Now all I need is a way to pass the name of the field dynamically rather than by its literal name.
Thank you for your help once again.
Couldn't you simple just use OnObjectEnter with this script:
Set Variable [$$ActiveField; Value: Get(ActiveFieldContents)]
To check, in a sample I put this script trigger on every field and created a new field called sample. I also added a second line to the script,
Set Field [Table::Sample; $$ActiveField]
As I click into any field, the sample field displayed the content of the field I clicked into
Thank you for your help. Yes, this does collect the data but only if the field is formatted as a drop-down list. It does not work if the field is a menu. The Variable is empty.
On a slightly different note, but related to all this, do you know how to set the full name of a related field into a variable?
i.e. RelatedTable::FieldName I can only get a variable to set with the field name if it's in the same table.