简体   繁体   English

SharePoint沙盒自定义工作流活动可基于多个条件从另一个列表中获取价值

[英]SharePoint Sandboxed Custom Workflow Activity to get value from another list based on multiple criteria

I'm trying to write a sandboxed custom workflow activity that would go to another list and get a value of a field based on values of multiple other fields combined. 我正在尝试编写一个沙盒自定义工作流程活动,该活动将转到另一个列表并根据多个其他字段的组合值获取一个字段的值。

List A 清单A

  • State - lookup to States list 州-查找州列表
  • City - lookup to Cities list 城市-查找城市列表
  • Population - Number 人口-人数
  • ... other columns ...其他专栏

(essentially the combination of State and City makes the row uniquely identifiable) (基本上,州和城市的组合使得该行可以唯一标识)

List B 清单B

  • Company - lookup to Companies list 公司-查找公司列表
  • State - lookup to States list 州-查找州列表
  • City - lookup to Cities list 城市-查找城市列表
  • Affecting % of population - number (percent) 影响人口的百分比-数量(百分比)
  • Population Affected - Number field (to be filled in by the custom activity workflow) 受影响的人口-数字字段(由自定义活动工作流填写)
  • ... other columns ...其他专栏

Constrains: 限制条件:

  • I can't add Company field to List A due to unique / different permissions 由于唯一/不同的权限,我无法将“公司”字段添加到列表A
  • The lookup fields need to stay lookup fields and can not be transformed into single line of text fields. 查找字段需要保留查找字段,并且不能转换为单行文本字段。
  • Due to the fact that the fields are of type lookup, I can't concatenate them with a simple calculated column. 由于字段是查找类型,因此我无法将它们与简单的计算列连接在一起。
  • The solution must be sandboxed and not farm. 解决方案必须沙盒化,不能场化。 We aren't allowed to deploy dlls, only .wsp 我们不允许部署dll,只有.wsp

Problem: What I would need is a sandboxed custom workflow activity that triggers on List B item added/changed. 问题:我需要的是一个沙盒自定义工作流程活动,该活动在添加/更改的列表B项目上触发。 When triggered, activity grabs the State and City values from the item in list B, goes to List A and searches for a combination of the same State and City. 触发后,活动从列表B中的项目中获取州和城市的值,转到列表A,然后搜索相同州和城市的组合。 When found, it grabs the associated population. 找到后,它将捕获相关的人口。 Lastly it multiplies the population by the % from "Affecting % of population" and pastes that result into the "Population Affected" field. 最后,将人口乘以“影响人口百分比”中的百分比,然后将结果粘贴到“受影响的人口”字段中。

Bonus: At some point, I will also need a sandboxed custom workflow activity that triggers on List A item changed (the population field). 奖励:在某个时候,我还需要一个沙盒自定义工作流程活动,该活动在列表A项更改(填充字段)上触发。 When the population for specific State+City combination changes, the activity would go to List B and update all "Population Affected" fields that satisfy the same State+City for all companies (multiple rows). 当特定州/市组合的人口发生变化时,活动将转到列表B,并更新所有公司(多行)都满足相同州/市的所有“受影响人口”字段。

Thanks in advance! 提前致谢!

What you need is an event receiver. 您需要的是事件接收器。 Nothing you've stated above leads me to believe you need a workflow. 您上面所说的任何内容都不会让我相信您需要工作流程。 Look over my blog to see your options: 查看我的博客以查看您的选择:

http://mattbramer.blogspot.com/2012/11/binding-event-handlers-to-sharepoint.html http://mattbramer.blogspot.com/2012/11/binding-event-handlers-to-sharepoint.html

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM