Stop recalculation of default value on reload

G

Gunther Rohrer

I've got a form that looks up data from a secondary source which is a
SharePoint list and then populates the default value in several
fields. In this example, I have a SharePoint list of Vendors with all
their contact data. The InfoPath form (a Purchase Order) has a vendor
lookup dropdown that shows all the Vendors from the SharePoint list;
when a vendor is chosen it populates the address, phone number, etc.
in the proper InfoPath form fields. Everything works great. (I love
this capability!)

In some cases there is no data in the vendor list (e.g. contact
email), so I want to allow the person submitting the form to supply it
manually. This seems to work, because when the form is submitted to
the form library on SharePoijnt, I can see that the email column did
indeed receive the manually entered email data for the vendor.
However, if I open the form to modify, it reverts the email field to
blank again because it's looking-up the vendor data from the vendor
list all over again. The same thing happens for fields with data
received from the vendor list, such as phone number or address; the
form will store manually entered data on save, but then it reverts to
whatever the lookup value is on reload.

Is there a way to allow a one-time population of vendor data fields
from the SP list but allow manually entered data to persist in the
form moving forward?

Thanks for any help with this!
 
Z

Zhang Haiguang

Hi,

Please separate the rule on the vendor lookup dropdown to serverals rules
for every populated field.
For every rule, add an expression condition, such as the following:
string-length(xdXDocument:GetDOM("Employees")/dfs:myFields/dfs:dataFields/d:Employees/@FirstName[../@EmployeeID
= xdXDocument:get-DOM()/my:myFields/my:field3]) > 0
And in the action of the rule, set the populated field's value.

Maybe it could work for you.

InfoJet Service
InfoPath Web Form
[http://www.infojetsoft.com]
 
G

Gunther Rohrer

Thanks for the response, Zhang. I realized that my approach was
backward. Instead of setting the update action on the vendor look-up
field using rules, I was setting the default value on the target
fields. When I changed the approach to use rules to populate the
various vendor details from the vendor look-up field everything worked
as desired. Now updates to the field only occur when the vendor look-
up is changed and manually entered data after an initial vendor look-
up is not overwritten on subsequent reloads of the form.

Just gettin' my feet wet here, obviously! :)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top