none
【求助】CRM4.0 Assign记录的阻止相关问题 RRS feed

  • 问题

  • 大家好,


           现在我又这样一个需求,当我assign某条记录时,在Post Stage会调用Plugin检测此时是否满足一定条件,如果满足就继续,如果不满足条件则需要阻止这次Assign。不知有没有什么好的方法可以实现这一需求,希望能够得到大家的帮助,先谢谢大家了。
    crm4.0学步
    2009年6月2日 10:02

答案

  • 注册到pre plugin 是肯定的

    获取分派的ownerid,你可以通过
    SecurityPrincipal assignee= (SecurityPrincipal)context.InputParameters[ParameterName.Assignee];
    assignee.PrincipalId  //分派的ownerid
    Batistuta Cai-刀客 | 蔡敏生 | MS CRM MVP | Blog:http://caims.cnblogs.com
    2009年6月11日 1:04
    版主
  • 可以使用 InputParameters, 如果 owner 改变了, InputParameter 那里才有ownerid的值,如果没有改变, 就没有ownerid 的值了。

    所以你可以用  PreEntityImage 和 InputParameter 来实现你所要的需求。
    Darren Liu | 刘嘉鸿 | MS CRM MVP | English Blog: http://msdynamicscrm-e.blogspot.com | Chinese Blog: http://liudarren.spaces.live.com
    2009年6月11日 13:49
    版主

全部回复

  • 你需要使用 Pre Assign, 不要使用 post Assign。 Post 就是Save后的程序, Pre 是 Save 前的程序。 参考一下 SDK, 如果有什么问题, 就回来这里问吧。
    Darren Liu | 刘嘉鸿 | MS CRM MVP | English Blog: http://msdynamicscrm-e.blogspot.com | Chinese Blog: http://liudarren.spaces.live.com
    2009年6月3日 19:25
    版主
  • 你好,我判断条件中有个参数Ownerid需要post Assign后的Ownerid,再用这个Ownerid去检测当前Entity有无此post assign后Ownerid的记录存在,如果有就需要阻止这次Assign操作,但如果用Pre Assign我就得不到Post entity中的值了,不知道有没有什么办法可以实现这种需求,先谢谢了


    crm4.0学步
    2009年6月3日 20:21
  • 注册到pre plugin 是肯定的

    获取分派的ownerid,你可以通过
    SecurityPrincipal assignee= (SecurityPrincipal)context.InputParameters[ParameterName.Assignee];
    assignee.PrincipalId  //分派的ownerid
    Batistuta Cai-刀客 | 蔡敏生 | MS CRM MVP | Blog:http://caims.cnblogs.com
    2009年6月11日 1:04
    版主
  • 可以使用 InputParameters, 如果 owner 改变了, InputParameter 那里才有ownerid的值,如果没有改变, 就没有ownerid 的值了。

    所以你可以用  PreEntityImage 和 InputParameter 来实现你所要的需求。
    Darren Liu | 刘嘉鸿 | MS CRM MVP | English Blog: http://msdynamicscrm-e.blogspot.com | Chinese Blog: http://liudarren.spaces.live.com
    2009年6月11日 13:49
    版主