Mapping Lookup fields
Last updated
Was this helpful?
Last updated
Was this helpful?
Keyfax scripts can return data that is used to make a selection in Lookup fields in your Dynamics forms. It is important to ensure that the data supplied by the Keyfax script exactly matches the item as it appears in Dynamics, e.g. if you want this to become the current selection:
your script will need to return the exact value 'Anti-Social Behaviour'. Lookup field selections can only be made via FetchXml queries. This is necessary in order to find the internal Id of the selection. Considering the example above, this involves two Mapping entries and a FetchXml query:
The first will read the CaseType value from the data exported by the Keyfax script. This Mapping will either pick up the data pointed at by the xPath statement in the Source, or, if this isn't found, the default text 'General Enquiry' will be used. The value returned is not going to be stored directly into a Dynamics Form field, rather, it is going to be used as a Bookmark inside a FetchXml query that will pick up the required unique Id. For this reason, the target is set to 'null', e.g:
Create the FetchXml query that will retrieve the Id of the Lookup entry that we wish to select (i.e. cust_casetypeid). This uses the value supplied by the Bookmark above, so at run time the condition statement actually reads as:
Finally, the Mapping entry itself which executes the FetchXml statement above and the cust_casetype Target will now reflect the expected selection:
resulting in: