problem of custom plugin (how to block the creation instead of throw exception)

질문 problem of custom plugin (how to block the creation instead of throw exception)

  • 2012년 6월 28일 목요일 오전 9:36
     
     

     


    hi, i created two plugin.

    lets say there is A and B plugin, B will be triggered by A

    A triggered by contact create post and gender = M

    B triggered by contact create post and gender = F

    the scenario is :

    when contact with gender =M created, A is triggered, then it will create a contact = F, B is triggered. however there is an opportunity that block the creation of F. i am using throw exception to block the creation of contact of B. but it will cause plugin error to A (because it is synchronous, i think it is because A cannot receive the exception from B)

    anyone how can i block the creation of B but will not cause the plugin error of A  ?

    thanks


    a

모든 응답

  • 2012년 6월 28일 목요일 오전 10:21
    중재자
     
     
    In Crm2011, the only way for a plugin to cancel an operation is to throw an exception on the Pre stage - there is no way to cancel the operation without throwing an exception. However, you should be able to catch that exception in the calling code

    Microsoft CRM MVP - http://mscrmuk.blogspot.com/ http://www.excitation.co.uk

  • 2012년 6월 29일 금요일 오전 2:06
     
     

    ic,

    about the exception of B, is there any way to throw an exception which will not cause plugin error to the plugin A which used to trigger B?


    a

  • 2012년 6월 29일 금요일 오전 3:48
     
     

    my issue is:

    when i throw an exception.  i can stop the creation of it

    however, everything that the plugin have done is reversed 

    for example i updated an items before exception is threw. it will be reversed if i throw exception after it is updated. but i want the update progress remain. i just want to prevent the creation of the context entity . is it possbile ?

    thanks


    a