4. Typical InfoPath Solutions (Integrated)
Not that hard, until
the last 30% or so
Something for
Everybody Basic InfoPath Solutions (OOB)
a tale of 3 cubes OR
how to follow along at home
Easy (once you know
a few tricks)
Developer InfoPath Solutions (Code)
Awesomely flexible,
but you can get into
trouble quickly
5. No msgbox.Show() like methods
Display a [fake]
message box on Normal Rule “Show value of field” not IPFS
the web (IPFS) compatible
Build your own based on a view
• Centered table with data-bound text field and OK button
• Store the “message” in a field and set before switching views
• Use “dimmed” background for nice effect
1 For special purpose dialogs, create their own view
8. Add resource from Data tab
Use Resource Use resources in picture buttons
Files (“picture” and “hover”)
• That way they are only stored once, even if
you copy and paste them multiple times.
Use resources for secondary data
source XML files (see also tip #19)
2
9. Use validation
rules to allow Add an IsSubmitting
variable validation Boolean field
checking (to
support drafting)
Don’t use “Can’t Be
Blank” field property
Create Validation rule
3 that checks IsSubmitting
property
10. Use either views or hidden sections for content
Use either styled command buttons or custom picture buttons for the tabs
Create a Tabbed
Interface
4
11. Use formatting rules and “currentTab” field to control which tab
is shown as active. If using hidden sections, then they are also
controlled by formatting rules (based on currentTab value)
Create a Tabbed
Use click action rules to set currentTab field. If using views, then
Interface this action will also change the current view.
4
12. Use SP library to
dynamically swap Secondary data source – SP List w/
images using rules Picture Column
and secondary
data source
Use picture object in form
Use rules to query
5 • filter by something unique, like ID or
filename)
13. To open up a new form instance in a form library:
Create a link
from anywhere /_layouts/FormServer.aspx?XsnLocation
to a form in IPFS =[URLtoXSN]&Source=[URLtoRedirectW
henDone]&DefaultItemOpen=1
To open up an existing form instance in a form
library, just set link to the InfoPath file (.xml)
6 /[PathToDocLib]/[PathToFile].xml
14. Create a link To open up a new list item with customized form:
from anywhere
to a form in IPFS
/_layouts/listform.aspx?PageType=8&
ListId=[ListGUID]&RootFolder=
To open up an existing list item with customized
form:
6 /_layouts/listform.aspx?PageType=6&
ListId=[ListGUID]&ID=[ItemID]
15. Disable the
Create a copy of the FormServer.aspx layouts page, and inject
backspace key in some “anti-backspace” javascript code in the <head> section
browser form
(IPFS)
7 Change your form links to your new aspx page
16. Allows business users / analysts to create and maintain business
calculation logic in the tool they know best (Excel)
Use Excel Services
REST interface to Create Excel Doc, add named ranges for parameters (inputs) and
return values (outputs).
host business
calculation logic Publish to Excel Services in SharePoint
8
17. Use Excel Services Add REST Webservice DataSource in InfoPath with an URL:
REST interface to
/_vti_bin/ExcelRest.aspx/Shared%20Documents/ratecalc.xlsx/
host business Model/Ranges(‘BILLRATE')?$format=atom&Ranges(‘SALARY')=0
calculation logic &Ranges(‘GP')=0
Create a rule of type “Change REST URL” and use a formula (concat) to put
in the parameter values you want, then run “Execute Query” the data
connection.
8
18. Grab the return value in the secondary data source – find
Use Excel Services the named range, and grab the “fv” value from the cell
REST interface to
host business
calculation logic
8
19. • Easy way to insert charts and graphs into InfoPath
Use Excel Services • Construct a URL similar to the way outlined in the previous
tip, but use “image” format, and /model/Charts(‘xxx’)
REST interface to
embed a dynamic /_vti_bin/ExcelRest.aspx/Shared%20Documents/rest_demo
.xlsx/Model/Charts(‘CHART1')?$format=picture&
chart Ranges('PARAMETER1')=0&Ranges('PARAMETER2')=0
• Have a named chart/graph in Excel doc that is published to
Excel Services in SharePoint.
• In InfoPath insert a Picture object/field (use “as a link”)
• In a rule, set the picture field value to the dynamic URL you
9
created above (use formula to inject parameter values)
• Image will auto-refresh when the field value changes
20. • Put data in a single list with denormalized values, e.g. :
Country SubRegion Region
Angola Central Africa Africa
Basic cascading Cameroon
Djibouti
Central Africa
Eastern Africa
Africa
Africa
drop downs (single Fiji Melanesia Oceana
denormalized list) • Create secondary data source, query data when
appropriate – this could be a list in SharePoint or XML
• Create you controls/fields, set them to
“Get choices from an external data
source”, bind the display name and value
fields to the appropriate fields in the
10 secondary data source
• Check “Show only entries with unique
display names”
21. Set filter conditions on each (except the top level) so that it only
displays rows that match the parent field’s selected value (from
the main data source)
Basic cascading
drop downs (single
denormalized list)
10
22. Set rule actions on each control (except the bottom
level) so that when it’s value changes the downstream
selection (previous choice) is cleared (set value = “”)
Basic cascading
drop downs (single
denormalized list)
10
23. Set up each list with it’s own secondary data source
Parent/Child Set up drop down controls to be bound to the appropriate
data from data source and set the display/value mappings
SharePoint lists
Create an action rule for the “parent” dropdown.
• Set the query field for the child data
source to be the current (selected)
value in the parent field
• Execute the query on the secondary
data source
11
24. If you get the error stating the form was deployed successfully
Fix Sandbox Code but can only be opened in InfoPath Filler:
Deployment Issues Ensure you have browser compatibility turned on
for Large
Forms/Code Address any errors the design checker shows
Check the ULS Log, filter on “InfoPath”, fix any code problems
Increase the WorkerProcessExecutionTimeout
• $spcode = [Microsoft.SharePoint.Administration.SPUserCodeService]::Local
$spcode.WorkerProcessExecutionTimeout = 45
$spcode.Update()
12
(then restart services on all servers where it is running)
Decrease complexity of the form
Split functionality into multiple forms
25. Create an XML file with your tooltips and save to
SharePoint
Use an XML file
and rich-text
controls to store
re-usable tooltips
Add XML file as a secondary data source in InfoPath
13 Drag field to form as RTB, then clean up formatting
26. Create wizard Wizard interfaces are great when you need to
interfaces when control what information is displayed to a user in
you have lots of serial path logic. Use one of the following
conditional logic methods:
for data collection
Hidden Sections
• Show sections based on a variable (“StepNum”) and change
this variable based on the click action of a button (“Next”)
combined with your conditional logic from other fields
14
Views
• Navigate to views based on click action of button (“Next”)
combined with your conditional logic from other fields
27. • Add secondary data source (SOAP)
Query user data
from the
UserProfileData
Web Service
15
28. Set the AccountName queryfield
Query user data
from the Execute the Query
UserProfileData Filter by PropertyData:Name
Web Service
Grab the ValueData:Value field
15
29. Convert data connections to Data Connection Files
Moving data
Move UDCX files into a Module Feature for deployment
connections from
one environment Create a feature receiver to replace ListID GUID’s and Web URL’s
to another
16
30. String comparisons are case sensitive
Using the XPATH
translate function Use translate formula to do case-insensitive comparisons
for case-insensitive
comparing
translate(/my:field1,
“ABCDEFGHIJKLMNOPQRSTUVWYXZ”,
“abcdefghijklmnopqrstuvwyxz”)
17
31. Use the XPATH eval(eval(group, “field”), “..”)
Double-Eval trick
to parse through a
repeating section
eval(eval(group, “concat(field, ‘; ‘)”, “..”)
18
32. Store variable
Variable Values
values in
• Only needed at run-time
secondary XML • Do not need to be persisted across sessions
data source • Initialized on form load
Do not store these in the main data connection
• Increases form instance file storage size
• Increases form schema complexity
Create a secondary XML data source for these
19 • Add XML file as a resource (see tip #2)
• Remember to initialize values as needed
33. How to track if
your form has Add secondary data source for variable usage
(see tip #20)
been changed or
not (dirty-check) Add a variable to this named “InitialState”
On FormLoad event, Set this variable to the root
node of the main data source
20
When you need to do a dirty-check, compare the
root node of the main data source to this field
34. • Use VSTA to set debugging options
• Project Menu – Properties – Build – Advanced – Debug Info
Debug Your
Server-Side
Sandbox Code
• Tools Menu – Options – Debugging – General – JIT Settings
21 • Build and publish form to server
• Use VS2005, load project, set breakpoints
• Debug - Attach to SPUCWorkerProcess.exe
35. Create a field mapping in your form and mark it as an web
part connectable parameter
Passing data into
a form using a On your page add an InfoPath form viewer web part and a
querystring filter webpart. Configure both.
QueryString
Connect the filter web part to the InfoPath webpart using
the field that you defined above.
22
36. Use an SPD
workflow and an
impersonation
step to move form
to a secured
library
23
40. • Problem is that browser will retain scroll position when
Fix IPFS Scroll doing a server side post-back, even if the view changes so
that scroll-position is no longer in context
Behavior when • Not just a problem for InfoPath views. Happens elsewhere
changing to a in SharePoint (like paging through a list)
new view • I have no solution, but have done much investigation
• Root cause is in core.js javascript
• Could be fixed by injecting some javascript to counter the
auto-scroll behavior (see tip #7)
• Tricky part is deciding when you should scroll and when not
to scroll… this behavior is defaulted this way for a reason!
27 • I’d love to work with some of you on this!
42. Follow SharePoint Saturday
Ozarks on Twitter @SPSOzarks
hashtag #SPSOzarks
Stop by and thank our
Housekeeping sponsors for making this
event possible!
Fill out and turn in evaluation
forms to be eligible for the
end-of-day raffle. You must be
present to win.
Don’t miss “This Modern
Station” tonight at Waxy
O’Shea’s!
43. Please find me:
• (to learn) BLOG: http://thekickboard.com
Thank You! • (to hire me) COMPANY: http://kickstudios.com
• (to stalk) TWITTER: http://twitter.com/thekicker
• (to spam) EMAIL: kevin@dostalek.com
• (to hang) LOUNGE: meetme@the.bar
Please be sure you:
• Create some super awesome InfoPath solutions
• Use InfoPath responsibly (think maintainability!)