Quickflow-how to obtain other list data through QFD and executecode

Source: Internet
Author: User

Scenario:There is a configuration list to configure the approver for each step. The configuration list fields are as follows:

Title:Workflow name

Level1approver: Step 1 approver

Level2approver: Step 2 approver

Procedure:

Please first understand the executecode activity:Http://www.cnblogs.com/jianyi0115/archive/2011/04/17/2018872.html

Create a workflow, add two string type workflow variables: level1approver , level2approver

Drag oneExecutecodeActivity, drag twoTaskActivity,TaskActiveUserBind propertiesLevel1approver,Level2approver.

Draw line connectionStart-> ExecuteCode-Task1-> task2.

Double-clickExecutecode, Write the script as follows:

Queryfield titlefield = new queryfield ("title ");

Splist cfglist = This. Web. Lists ["Approver Configuration"]; //Retrieve list

VaR cfgitem = listquery. From (cfglist). Where (titlefield ="Business card application"). Getitems () [0]; //Configuration item retrieved

//Get Field Value

Spfielduservalue user1value = cfgitem. Fields. getfield ("level1approver"). getfieldvalue (cfgitem ["level1approver"]. tostring () as spfielduservalue;

VaR level1user = user1value. User. loginname;

This. Log ("getlevel1approver:" + level1user );//Write debugging logs

This. setvariable ("level1approver", level1user );//Set Variables

//Get Field Value

Spfielduservalue user2value = cfgitem. Fields. getfield ("level2approver"). getfieldvalue (cfgitem ["level2approver"]. tostring () as spfielduservalue;

VaR level2user = user2value. User. loginname;

This. Log ("getlevel2approver:" + level2user );

This. setvariable ("level2approver", level2user );

Workflow:

Add variable:

Code:

Note:

If you have the ability to write in a custom formCodeTry to pass the required data into the workflow variables before submitting the code-written form.

If an error occurs while executing code in the workflow, the entire workflow fails and cannot be recovered. Only the process can be restarted.

 

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.