SharePoint: Extended DVWP-Part 2: Passing workflow variables in a form operation Workflow

Source: Internet
Author: User
Document directory
  • Form operations

In the previous four blog posts, we discussed how to create a workflow from the form operation link of the Data View webpart (DVWP. To continue with this topic, we have mastered how to pass form fields to workflows. This technique is indeed powerful. However, what if you want to transfer more information contained in the form to the workflow?

Here is an application of this type.

Form operations

Remember, the modified form operations in a wizard are displayed in the HREF attribute of the link as JavaScript calls in the order listed in the Wizard.

1. Right-click the link and select "form operation..." from the context menu to run the form operation wizard (edit template from ).

2. To run/create a workflow, add a [custom operation] and click set.

3. Click "variable ".

We must create a variable in the workflow that will receive the data we passed.

4. Click "add ...".

5. Enter the name and type for our variables.

Regardless of the type you set, the workflow converts the type to a string. (More details will be discussed in future blog posts .)

6. All variables created for the workflow can be accessed through "workflow data. Next we will discuss how to pass data to these created variables and use the data in our workflow.

7. Let's take a look at the JavaScript call in the href of the form operation link after the workflow is created:

After

<A href = "javascript: {ddwrt: GenFireServerEvent (concat ('_ workflowStart = {A50B3A56-0C82-43E3-917E-D37E2E036F3B}, New, {F6244C84-AAE5-45E0-9C71-60F6AB31F584}, ff1_x007b _ x0024_Pos_x007d _ = {ff1 ', $ Pos, '} * ff2_x007b _ x0024_Pos_x007d _ = {ff2', $ Pos, '} * ff3_x007b _ x0024_Pos_x007d _ = {ff3', $ Pos, '} * ff4_x007b _ x0024_Pos_x007d _ = {ff4', $ Pos, '} * ff5_x007b _ x0024_Pos_x007d _ = {ff5', $ Pos, '} * ff6_x007b _ x0024_Pos_x007d _ = {ff6', $ Pos, '} * ff7_x007b _ x0024_Pos_x007d _ = {ff7', $ Pos ,'}*}; __commit ')} "> Save the file </a>

We have discussed in detail the syntax of this code in the previous two blog posts. This time, we will only look at the fourth parameter of the _ workflowStart function.

Remember, the fourth parameter is as follows:

ff1_x007b__x0024_Pos_x007d_={ff1',$Pos,'}*ff2_x007b__x0024_Pos_x007d_={ff2',$Pos,'}*ff3_x007b__x0024_Pos_x007d_={ff3',$Pos,'}*ff4_x007b__x0024_Pos_x007d_={ff4',$Pos,'}*ff5_x007b__x0024_Pos_x007d_={ff5',$Pos,'}*ff6_x007b__x0024_Pos_x007d_={ff6',$Pos,'}*ff7_x007b__x0024_Pos_x007d_={ff7',$Pos,'}*

Workflow Variables-All variables in the code above are automatically added so that we can access the values of form fields. Fortunately, we can use the same syntax to add any fields we need.

For example, if we need to pass a string such as "Insert" so that we can write an audit trail, we can simply add myVar = Insert * to the list of value pairs, in this way, you can useWorkflow dataAccess this value in the form of myVar.

Therefore, to add our variables, you can simply add the name/value pair to the end:

ff1_x007b__x0024_Pos_x007d_={ff1',$Pos,'}*ff2_x007b__x0024_Pos_x007d_={ff2',$Pos,'}*ff3_x007b__x0024_Pos_x007d_={ff3',$Pos,'}*ff4_x007b__x0024_Pos_x007d_={ff4',$Pos,'}*ff5_x007b__x0024_Pos_x007d_={ff5',$Pos,'}*ff6_x007b__x0024_Pos_x007d_={ff6',$Pos,'}*ff7_x007b__x0024_Pos_x007d_={ff7',$Pos,'}*myVar=Insert*

Because this is a large string separated by asterisks (actually terminated), do not use quotation marks on both sides. In other words, if you want the value of myVar to contain a space (such as "New Item"), the asterisk is the end of the string, so you can write it like this:

... *MyVar = New Item *

Note: asterisks (*) are more appropriate than delimiters. In other words, it is not used to separate data. In fact, it marks the end of each name/value pair. This is exactly why it ended with a star instead of appearing only between two name/value pairs. So,Do not forget the last Asterisk.

 

Next time: Why not all fields appear in the form field? We will discuss this in detail in the next extended DVWP series.

 

References


SharePoint: Extending the DVWP-Part 10: Passing Workflow Variables to a Form Action Workflow

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.