+ All Categories
Home > Technology > Top 20 something info path 2010 tips and trips - sps-ozarks12

Top 20 something info path 2010 tips and trips - sps-ozarks12

Date post: 26-Jan-2015
Category:
Upload: kevin-dostalek
View: 25,302 times
Download: 1 times
Share this document with a friend
Description:
 
43
Top Twenty-Something InfoPath 2010 Tips & Tricks SHAREPOINT SATURDAY, OZARKS 2012 PRESENTED BY: KEVIN DOSTALEK
Transcript
Page 1: Top 20 something info path 2010 tips and trips - sps-ozarks12

Top Twenty-Something InfoPath 2010 Tips & TricksSHAREPOINT SATURDAY, OZARKS 2012

PRESENTED BY: KEVIN DOSTALEK

Page 2: Top 20 something info path 2010 tips and trips - sps-ozarks12

Introductionswho‘s who

Page 3: Top 20 something info path 2010 tips and trips - sps-ozarks12

Agendawhat‘s what

Page 4: Top 20 something info path 2010 tips and trips - sps-ozarks12

Something for Everybodya tale of 3 cubes ORhow to follow along at home

Not that hard, until the last 30% or so

Easy (once you know a few tricks)

Awesomely flexible, but you can get into

trouble quickly

Typical InfoPath Solutions (Integrated)

Basic InfoPath Solutions (OOB)

Developer InfoPath Solutions (Code)

Page 5: Top 20 something info path 2010 tips and trips - sps-ozarks12

Display a [fake] message box on the web (IPFS)

No msgbox.Show() like methods

Normal Rule “Show value of field” not 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

For special purpose dialogs, create their own view1

Page 6: Top 20 something info path 2010 tips and trips - sps-ozarks12

Display a [fake] message box on the web (IPFS)

1

Page 7: Top 20 something info path 2010 tips and trips - sps-ozarks12

Display a [fake] message box on the web (IPFS)

1

Page 8: Top 20 something info path 2010 tips and trips - sps-ozarks12

Use Resource Files

Add resource from Data tab

Use resources in picture buttons (“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

Page 9: Top 20 something info path 2010 tips and trips - sps-ozarks12

Use validation rules to allow variable validation checking (to support drafting)

3

Add an IsSubmitting Boolean field

Don’t use “Can’t Be Blank” field property

Create Validation rule that checks IsSubmitting property

Page 10: Top 20 something info path 2010 tips and trips - sps-ozarks12

Create a Tabbed Interface

Use either views or hidden sections for content

Use either styled command buttons or custom picture buttons for the tabs

4

Page 11: Top 20 something info path 2010 tips and trips - sps-ozarks12

Create a Tabbed Interface

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)

Use click action rules to set currentTab field. If using views, then this action will also change the current view.

4

Page 12: Top 20 something info path 2010 tips and trips - sps-ozarks12

Use SP library to dynamically swap images using rules and secondary data source

5

Secondary data source – SP List w/ Picture Column

Use picture object in form

Use rules to query

• filter by something unique, like ID or filename)

Page 13: Top 20 something info path 2010 tips and trips - sps-ozarks12

Create a link from anywhere to a form in IPFS

6

/_layouts/FormServer.aspx?XsnLocation=[URLtoXSN]&Source=[URLtoRedirectWhenDone]&DefaultItemOpen=1

/[PathToDocLib]/[PathToFile].xml

To open up a new form instance in a form library:

To open up an existing form instance in a form library, just set link to the InfoPath file (.xml)

Page 14: Top 20 something info path 2010 tips and trips - sps-ozarks12

Create a link from anywhere to a form in IPFS

To open up a new list item with customized form:

To open up an existing list item with customized form:

6

/_layouts/listform.aspx?PageType=8&ListId=[ListGUID]&RootFolder=

/_layouts/listform.aspx?PageType=6&ListId=[ListGUID]&ID=[ItemID]

Page 15: Top 20 something info path 2010 tips and trips - sps-ozarks12

Disable the backspace key in browser form (IPFS)

7

Create a copy of the FormServer.aspx layouts page, and inject some “anti-backspace” javascript code in the <head> section

Change your form links to your new aspx page

Page 16: Top 20 something info path 2010 tips and trips - sps-ozarks12

Use Excel Services REST interface to host business calculation logic

Allows business users / analysts to create and maintain business calculation logic in the tool they know best (Excel)

Create Excel Doc, add named ranges for parameters (inputs) and return values (outputs).

Publish to Excel Services in SharePoint

8

Page 17: Top 20 something info path 2010 tips and trips - sps-ozarks12

Use Excel Services REST interface to host business calculation logic

Add REST Webservice DataSource in InfoPath with an URL:

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

/_vti_bin/ExcelRest.aspx/Shared%20Documents/ratecalc.xlsx/Model/Ranges(‘BILLRATE')?$format=atom&Ranges(‘SALARY')=0&Ranges(‘GP')=0

Page 18: Top 20 something info path 2010 tips and trips - sps-ozarks12

Use Excel Services REST interface to host business calculation logic

Grab the return value in the secondary data source – find the named range, and grab the “fv” value from the cell

8

Page 19: Top 20 something info path 2010 tips and trips - sps-ozarks12

Use Excel Services REST interface to embed a dynamic chart

• Easy way to insert charts and graphs into InfoPath

• Construct a URL similar to the way outlined in the previous tip, but use “image” format, and /model/Charts(‘xxx’)

• 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 created above (use formula to inject parameter values)

• Image will auto-refresh when the field value changes9

/_vti_bin/ExcelRest.aspx/Shared%20Documents/rest_demo.xlsx/Model/Charts(‘CHART1')?$format=picture&Ranges('PARAMETER1')=0&Ranges('PARAMETER2')=0

Page 20: Top 20 something info path 2010 tips and trips - sps-ozarks12

Basic cascading drop downs (single denormalized list)

• Put data in a single list with denormalized values, e.g. :

• 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 valuefields to the appropriate fields in the secondary data source

• Check “Show only entries with unique display names”10

Country SubRegion Region

Angola Central Africa Africa

Cameroon Central Africa Africa

Djibouti Eastern Africa Africa

Fiji Melanesia Oceana

Page 21: Top 20 something info path 2010 tips and trips - sps-ozarks12

Basic cascading drop downs (single denormalized list)

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)

10

Page 22: Top 20 something info path 2010 tips and trips - sps-ozarks12

Basic cascading drop downs (single denormalized list)

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 = “”)

10

Page 23: Top 20 something info path 2010 tips and trips - sps-ozarks12

Parent/Child data from SharePoint lists

Set up each list with it’s own secondary data source

Set up drop down controls to be bound to the appropriate data source and set the display/value mappings

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

Page 24: Top 20 something info path 2010 tips and trips - sps-ozarks12

Fix Sandbox Code Deployment Issues for Large Forms/Code

If you get the error stating the form was deployed successfully but can only be opened in InfoPath Filler:

12

Ensure you have browser compatibility turned on

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()(then restart services on all servers where it is running)

Decrease complexity of the form

Split functionality into multiple forms

Page 25: Top 20 something info path 2010 tips and trips - sps-ozarks12

Use an XML file and rich-text controls to store re-usable tooltips

Create an XML file with your tooltips and save to SharePoint

Add XML file as a secondary data source in InfoPath

Drag field to form as RTB, then clean up formatting13

Page 26: Top 20 something info path 2010 tips and trips - sps-ozarks12

Create wizard interfaces when you have lots of conditional logic for data collection

Wizard interfaces are great when you need to control what information is displayed to a user in serial path logic. Use one of the following methods:

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

Views

• Navigate to views based on click action of button (“Next”) combined with your conditional logic from other fields14

Page 27: Top 20 something info path 2010 tips and trips - sps-ozarks12

Query user data from the UserProfileDataWeb Service

• Add secondary data source (SOAP)

15

Page 28: Top 20 something info path 2010 tips and trips - sps-ozarks12

Query user data from the UserProfileDataWeb Service

Set the AccountName queryfield

Execute the Query

Filter by PropertyData:Name

Grab the ValueData:Value field

15

Page 29: Top 20 something info path 2010 tips and trips - sps-ozarks12

Moving data connections from one environment to another

Convert data connections to Data Connection Files

Move UDCX files into a Module Feature for deployment

Create a feature receiver to replace ListID GUID’s and Web URL’s

16

Page 30: Top 20 something info path 2010 tips and trips - sps-ozarks12

Using the XPATH translate function for case-insensitive comparing

String comparisons are case sensitive

Use translate formula to do case-insensitive comparisons

17

translate(/my:field1, “ABCDEFGHIJKLMNOPQRSTUVWYXZ”, “abcdefghijklmnopqrstuvwyxz”)

Page 31: Top 20 something info path 2010 tips and trips - sps-ozarks12

Use the XPATH Double-Eval trick to parse through a repeating section

eval(eval(group, “field”), “..”)

eval(eval(group, “concat(field, ‘; ‘)”, “..”)

18

Page 32: Top 20 something info path 2010 tips and trips - sps-ozarks12

Store variable values in secondary XML data source

Variable Values

• Only needed at run-time

• Do not need to be persisted across sessions

• 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

• Add XML file as a resource (see tip #2)

• Remember to initialize values as needed19

Page 33: Top 20 something info path 2010 tips and trips - sps-ozarks12

How to track if your form has been changed or not (dirty-check)

Add secondary data source for variable usage (see tip #20)

Add a variable to this named “InitialState”

On FormLoad event, Set this variable to the root node of the main data source

When you need to do a dirty-check, compare the root node of the main data source to this field20

Page 34: Top 20 something info path 2010 tips and trips - sps-ozarks12

Debug Your Server-Side Sandbox Code

• Use VSTA to set debugging options• Project Menu – Properties – Build – Advanced – Debug Info

• Tools Menu – Options – Debugging – General – JIT Settings

• Build and publish form to server

• Use VS2005, load project, set breakpoints• Debug - Attach to SPUCWorkerProcess.exe21

Page 35: Top 20 something info path 2010 tips and trips - sps-ozarks12

Passing data into a form using a QueryString

Create a field mapping in your form and mark it as an web part connectable parameter

On your page add an InfoPath form viewer web part and a querystring filter webpart. Configure both.

Connect the filter web part to the InfoPath webpart using the field that you defined above.

22

Page 36: Top 20 something info path 2010 tips and trips - sps-ozarks12

Use an SPD workflow and an impersonation step to move form to a secured library

23

Page 37: Top 20 something info path 2010 tips and trips - sps-ozarks12

Setting a dynamic submit location in code

24

Page 38: Top 20 something info path 2010 tips and trips - sps-ozarks12

Centralize your Form XPATHs

25SetFieldValue(FormXpaths.ApplicantUsername, "test\admin", false);

Page 39: Top 20 something info path 2010 tips and trips - sps-ozarks12

Build your XML Helper Library

26

Page 40: Top 20 something info path 2010 tips and trips - sps-ozarks12

Fix IPFS Scroll Behavior when changing to a new view

• Problem is that browser will retain scroll position when doing a server side post-back, even if the view changes so that scroll-position is no longer in context

• Not just a problem for InfoPath views. Happens elsewhere in SharePoint (like paging through a list)

• 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!

• I’d love to work with some of you on this!27

Page 41: Top 20 something info path 2010 tips and trips - sps-ozarks12

Thanks to Our Sponsors!

Platinum

Page 42: Top 20 something info path 2010 tips and trips - sps-ozarks12

Housekeeping

Follow SharePoint Saturday Ozarks on Twitter @SPSOzarkshashtag #SPSOzarks

Stop by and thank our 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!

Page 43: Top 20 something info path 2010 tips and trips - sps-ozarks12

Thank You!

Please find me:

• (to learn) BLOG: http://thekickboard.com

• (to hire me) COMPANY: http://kickstudios.com

• (to stalk) TWITTER: http://twitter.com/thekicker

• (to spam) EMAIL: [email protected]

• (to hang) LOUNGE: [email protected]

Please be sure you:

• Create some super awesome InfoPath solutions

• Use InfoPath responsibly (think maintainability!)


Recommended