Data Sources: Difference between revisions

m
no edit summary
mNo edit summary
mNo edit summary
Line 7: Line 7:
== Lifecycle of an Autofill from a custom data source ==
== Lifecycle of an Autofill from a custom data source ==
# When adding an entry, the user types a search key into a field in the Entry Edit card.
# When adding an entry, the user types a search key into a field in the Entry Edit card.
# The data source script is then executed, with the search key passed in as the global variable '''''query'''''.
# The data source script is then executed, with the search key passed in as the global variable ''query''.
# The user is presented with a list of matching objects found by the script.
# The user is presented with a list of matching objects found by the script.
# The user chooses one of the objects, and its properties are written to the mapped entry fields according to data load rules.
# The user chooses one of the objects, 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 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.


== Create a custom data source ==
== Create a custom data source ==