Friday, September 27, 2013

InfoPath Tutorial Cascading Dropdown (Does not have the 20 item limit)

I had read a number of tutorials on how to create a cascading dropdown using InfoPath 2010, but there was a 20 item limit (which is not very useful).  The lists I implemented this for actually have just under 5,000 items in order to not breach the threshold limit.  If you do have a list with over 5,000 items, the lookup column will not work until you raise the threshold limit to be above 5,000 items in Central Admin.

This post will explain how to create a cascading dropdown within InfoPath 2010 for a list content type.

Example Situation:  I am going to create a contact form which will filter the territories based upon the region of the form and then when I select the territory it will filter my store numbers to only show that territory’s stores.

My Hierarchy:

            Region
                       →Territories
                               → Store Numbers
Materials Needed:
SharePoint 2010 List Which Utilizes a Two Lookups
A SharePoint 2010 Content Type
InfoPath 2010
 
First we will need to navigate to the list:

1.    Open Your List

2.    Select List Tools

a.    Select List

3.    Select List Settings

4.    Select Form Settings Under General

5.    Select Your Content Type

6.    Select “Customize the current form using Microsoft Infopath”

This will open InfoPath with that content type’s fields.  We are modifying the form for this specific content type; we are not modifying the list form.

The next step is to create and style the form to meet your needs, for this example I created this from.





My form currently is displaying all of Mountain Store ID’s when in reality I only want the ID’s shown for that specific territory.

To create the cascading dropdown:

1.    Right click your child lookup field and select “Dropdown List box Properties…”

a.    

2.    The next step is to select Add…  We will be creating a new data source in order to implement our cascading dropdown

3.   


4.    


5.      


6.    Your URL for the site should be selected in the next screen

7.    Select the child list which your lookup pulls from.  In my example, my Mountain Store ID comes from my Mountain Region list.

8.    Step 9 is really what makes this entire thing work.  The default data connection only pulls the Mountain Store ID (aka Title) in the source list.  The new data connection will allow us to query the list to obtain additional data.  For our example I will be selecting Title & Territory since I will want to filter my ID’s down by the Territory.
       9.
10. Select Next

11. Select Next

12.   In step 13, make sure to DESELECT Automatically retrieve data when the form is opened.

13.
      14. Select Finish

15. Now that we have created the new data source, we need to switch the value to ID otherwise we will run into validation errors later.

16. 

17. Select OK

Now that the new data source has been created, we can use it to create our cascading dropdown!

1.    Select your parent field, in my case this field is territories.  (All of my store ID’s are tagged with the Territory they correspond with in the Mountain Region List)

2.    Select the Home Tab

3.    Select manage rules

4.    Select add rule

5.    Select New

6.    Select Action

7.    Within your rule, select Add “Set a fields value”

a.    We are going to set our Mountain Store ID to default to blank

b.     

8.    Create another Set Field Value Action.  In this action we will be setting our form to filter our Mountain Store ID’s based upon the territory.

9.    We are going to set this action to set our Territory to our newly created Data Sources Territory.

10. Select the fields icon next to the Field: dialog box 
 
11. A similar menu should appear like the one below:

12. 

13. Select the dropdown arrow and select the data source you just created.  In my example, it

14. is Mountain Region1

a.     

b.    Open Query Fields

c.     Open q:SharePointListItem_RW

d.    Select the field which corresponds with your parent field.  In my example, it is Territory

e.     Select OK

15.   We now need to set the value for the second parameter of the Rule Details.  Select the fx button and select your parent field from the main data source.

16.


17.


18. Select OK for all of the dialog boxes after you have selected your parent field from the main data source for the Value: input.

The last step to make this work is to query for data within the rule.  So once again, lets select Add Action, just like we did to set the ID initially to blank and to set the Territory = Territory.

1.    Select Add next to Run these actions

2.    Select Query for Data

3.    Select the Data source you created earlier from the dropdown box.

a.     


4.    Select OK

5.    Your final rule should have the 3 actions and resemble the below

a.     





Well that’s it Folks!  If you have followed the above steps correctly, you should now have a cascading lookup field!

Example For When I Select Denver

 
Example for When I Select Salt Lake
 
Cheers!
Dan
 

Thursday, September 26, 2013

How to Embed A PDF into A Webpage

This post will be relatively quick, since the ability to present a PDF file in a webpage within SharePoint is easy!

Materials Needed:

1.    A Text File .txt

2.    Content Editor Web part

3.    A SharePoint Page

The first step to showing the PDF within a webpage is to store the PDF on your SharePoint site where users will be able to access it.  Once you have uploaded your PDF copy the URL for the newly uploaded PDF file.

After you have uploaded the file, create a new text .txt document in Notepad.  Insert the below code into your text file, but replace the “Your URL HERE” with the URL of your PDF File.  Make sure to leave the “  “at each end since that is needed.


<embed src="YOUR PDF URL HERE.pdf" style="width: 100%!important; height: 1000px!important;style="z-index:-5;" scrolling="no" frameborder="no" allowtransparency="true">


Now that the file has been created, store the text file somewhere on your SharePoint site so we can link a content editor Web Part to it.

 

Place the content editor Web Part on your page and link it to the text file that you just uploaded, apply the changes, and save the page.  You should now your PDF within the browser!


 
Cheers!

Dan

Wednesday, September 25, 2013

Pop Up Form For Content Types And Custom Forms

I had a blog post earlier about how to link directly to the new form page for multiple content types, but how do we get that nice SharePoint pop up window that our users are used to seeing?  In my scenario I had created custom InfoPath 2010 forms for each of my content types in my SharePoint 2010 list.  This tutorial provides the syntax to make your links POP!  This is very simple, but is extremely handy if you want to keep the user on the same page and not have to redirect your user to the actual newform.aspx page.

Code Needed:

Javascript:OpenPopUpPage(‘Your URL For The New Form’)

Example

javascript:OpenPopUpPage('/sites/SiteName/Lists/ListName/newform.aspx?ContentTypeID=0x01002069B8F8E3CC074DB7793638F1D8896B’)


My example has the syntax to link directly to that content type's newform, rather than just using the newform.aspx which links to the default Content Type.

Cheers!

Dan