6

I have a requirement to pre-populate fields from an external source.

Is there a way to hook into a pipeline to achieve this? I'm thinking something similar to how Sitecore can populate the fields by query string by key value. i.e. when the form loads I pull my data from my external source and set the values of the fields by matching on field names.

You can obviously defined save actions for a form, is there a way to define a 'On Load' action?

I've seen another answer on here suggesting to create custom individual fields, but I don't really want to create a bunch of fields that individually get the data it needs; I'd rather do it from a higher level in one operation.

1 Answer 1

3

You can use the Rules Engine, there are a bunch of out-of-the-box rules that allow you to set the default field value based on a number of conditions:

WFFM Rules Engine

If you need to set the value to something else (i.e. values from your external source) then you can create custom a RuleAction that retrieves that values. Be a little careful with your action though and try to limit the number of calls to your external source otherwise this could lead to performance issues. It may be better to query your external source and store that data in the user profile or user session so you only query once.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.