Data Sources: Difference between revisions

m
no edit summary
mNo edit summary
mNo edit summary
Line 8: Line 8:


== Lifecycle of an Autofill from a custom data source ==
== Lifecycle of an Autofill from a custom data source ==
# A user types text in a field in an Entry Edit card for use as a key to look up information.
# When adding an entry, the user types a search key into a field in the Entry Edit card.
# The entered text is passed to the custom data source script in the form of the global variable '''''query'''''.
# The data source script is then executed, with the search key passed in as the global variable '''''query'''''.
# The data source script is executed.
# The user is presented with a list of matching objects found by the script.
# The user is presented with a list of objects found by the script.
# The user chooses an object, and its properties are written to the mapped entry fields according to data load rules.
# The user selects an object, and its properties are written to the mapped entry fields according to data load rules.
# If the script has also returned a function, that script function is then called with the selected object's '''''id''''' property as an argument, and when the script function returns the object, now loaded with additional data, the object's new properties are loaded into mapped fields according to data load rules.
# If a function is returned as a result of the script, the script function is called with the selected object's id property as the argument, and the returned object's properties are loaded into mapped fields according to data load rules.


== Adding a custom data source ==
== Adding a custom data source ==