Pages

Showing posts with label xpath. Show all posts
Showing posts with label xpath. Show all posts

Wednesday, July 15, 2009

Third Party SharePoint Workflow Actions

I stumbled on this Codeplex project and our server administrators were nice enough to add the project to our SharePoint farm. The tool adds 13 new workflow actions to the Workflow Wizard in SharePoint Designer. I’ve found the new actions to be very helpful, like sending an email with a list item’s attached files attached to the message, and getting the innerXML of an InfoPath element.

Link is below, and I’ve pasted the list of actions for reference as well. Worth installing in my opinion.

http://spdactivities.codeplex.com/

Available Activities
  1. Send Email with HTTP File attachment - Allows sending emails with attachments retrieved using a web request
  2. Send Email with List Item attachments - Allows sending list item attachments as files attached to an email
  3. Start Another Workflow - Starts another workflow associated with a list item
  4. Grant Permission on Item - Allows granting of specified permission level on a spicified item
  5. Delete List Item Permission Assigment - Allows deleting of specified permission level assigment for a given user
  6. Reset List Permissions Inheritance - removes any unique permissions assigned to an item by inheriting list permissions
  7. Is User a member of a SharePoint group - Checks if a given user is part of given sharepoint group
  8. Is Role assigned to User - Checks if a user role is already assigned on the current list item
  9. Lookup user info - allows to lookup properties in site's user information list for a given login
  10. NEW! Copy List Item Extended Activity - Allows copying/moving list items and files cross site.
  11. NEW! Send Email Extended - Enhaced version of the OOTB activity. Allows you to specify the sender. Also does not break links in body.
InfoPath activities - allow to query/change InfoPath form data using XPath

  1. Get InfoPath field inner text

  2. Get InfoPath field inner xml

Thursday, July 9, 2009

Concatenating a repeating field into a single string in InfoPath 2007

Here's the scenario: You have an InfoPath form that contains a repeating table, and that table is used to capture names and email addresses. You'd like to create a workflow in SharePoint Designer that will email some information to the users you entered in the form. The only problem is SharePoint Designer doesn't have a loop function in the workflow creation wizard.

To get around the issue, we're going to use a little xpath function to concatenate the email address fields in the repeating table together, separated by a semi-colon - this will let us drop that list right into the TO line of an email.

The setup:
  • Create a new InfoPath form using a blank template.
  • Add the following fields to the main data source:

message_subject
message_body
people (group)
     person (repeating group)
          name
          email
recipient list



  • Drag the message_subject and message_body fields onto the form to create text boxes for them, then drag the person repeating group onto the form and select 'Repeating Table'. Then, drag an expression box onto the screen and bind it to the recipient_list field, and finally, drag a button onto the form. I've set the button's label to 'Get Recipients'. Your whole form should now look like this:
















  • Next, lets edit the button's properties and create a new rule to execute when the button is clicked. From the Button Properties dialog, under the General tab hit the 'Rules' button. Hit the 'Add...' button to create a new Rule. Leave the Condition set to 'None - This rule always applies', and hit the 'Add Action...' button.
  • In the Action dialog, choose 'Set a fields value' from the 'Action' box, and use the button to set the 'Field' to update as the recipient_list field.














  • Now, hit the Fx button to supply a function, and type this in the function box:
     eval(eval(person, 'concat(my:email, ";")'), "..")
  • NOTE: You will need to highlight person, then using the 'Insert Field or Group' button, insert the person group. In the end, it should be underlined. The rest of the statement can be typed in manually.












  • Click Ok to get all the way back out to your form.
  • Now its time to test!
  • Hit the Preview button to preview the form.
  • Enter a name and email address in the first row of the table, then click the 'Insert item' link and add a second name and address. Then click the 'Get Recipients' button, and the email addresses will be concatenated together and separated by a semi-colon.



Part II of this post will focus on creating a Workflow in SharePoint designer to send your message.