简体   繁体   English

Dynamics CRM定制工作流女士使用C#从表单中获取可见属性

[英]Ms Dynamics CRM custom workflow get visible attributes from form using c#

How to get visible attributes from entity form using c# in custom workflow? 如何在自定义工作流中使用C#从实体表单获取可见属性? Any idea please share! 有什么想法请分享!

It's a PITA but it's doable. 这是PITA,但可行。

  1. retrieve the form you want to process from the systemform entity (you want the formxml attribute) 检索要在处理表单systemform实体(你想要的formxml属性)
  2. the formxml attribute contains the form definition, it's encoded ( < is written as &lt; and so on) xml format. formxml属性包含表单定义,它以xml格式编码( <表示为&lt;等)。

Inside the formxml contents, a field looks like this: formxml内容内,一个字段如下所示:

    <cell id="(guid)" labelid="(guid)" showlabel="true" locklevel="0" visible="false">
    <labels>
        <label description="(field label)" languagecode="1033" />
    </labels>
    <control id="(field name)" classid="(guid)" datafieldname="(field name)" disabled="false">
  1. parse the xml, looking for cell elements which do not have visible attribute (it's only there if the field is hidden) 解析xml,查找具有visible属性的cell元素(仅在隐藏字段时才存在)
  2. you might have to narrow the list down through further searches in xml (not 100% positive about what ie a subgrid would look like) but I have no direct experience with this kind of logic so I can't pinpoint each and every corner case 您可能需要通过在xml中进行进一步的搜索来缩小列表的范围(对于子网格的外观不是100%肯定的),但是我对这种逻辑没有直接的经验,因此我无法查明每个极端的情况

Pain point: You won't be able to tell if a field visibility has been toggled through javascript 痛点:您将无法判断javascript是否已切换字段可见性

What do you mean visible attributes? 您是什么意思可见属性? You mean attributes with a value or attributes showed in the form? 您是指带有值的属性还是以表格形式显示的属性? If it's the second the only way that you have to keep track of that is use a text field and use some code to identify what is active. 如果这是第二个,那么您唯一需要跟踪的方法就是使用文本字段,并使用一些代码来标识活动的内容。

ex. 例如 create a text field 创建一个文本字段

and write in it all the fields that are visible ex name and surname: 并在其中写下所有可见的姓名和姓氏字段:

"name","surname" “名字姓”

You can manipulate this with javascript and business rules to keep the list of fields updated at every time for each record. 您可以使用javascript和业务规则进行操作,以使每次记录的字段列表每次都保持更新。 In the code behind you just need to read for the text field and manipulate the magic string. 在后面的代码中,您只需要阅读文本字段并操作魔术字符串即可。 It's not a really nice operation, but is the only way i can see to keep track of what fields are shown on the form. 这不是一个很好的操作,但是这是我看到的唯一跟踪表单上显示哪些字段的方法。

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

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