how to refresh a form that is updated by a c# plugin - crm 2011

Answered how to refresh a form that is updated by a c# plugin - crm 2011

  • 26. července 2012 11:05
     
     

    hello friends.

    i need help in  refreshing an entity form after it is updated by a c# plug-in.

    scenario:
    entity A has a custom button i created (with ribbon editor)

    pressing the button will run a jscript that will update entity B.

    once entity B gets updated a plugin (c# code) is fired

    the plugin updates entity A.

    all works great.

    The problem is: How to refresh the form for entity A ? (we open this form to press the button and its fields values are updated by the plugin - how do i see the new values - how to reload/refresh the form?)

    Thanks in advance.


    • Upravený miro ocho 26. července 2012 11:08
    •  

Všechny reakce

  • 26. července 2012 11:17
    Moderátor
     
     Navržená odpověď

    Hi,

    There is no way to refresh crm entity form through plugin, but you can do a workaround using javascript, you can write a function in your entity a that will run after specific time slot and will check entity a in database if there is some updated value for your field you can call save method to refresh your form.

    you can refer http://a33ik.blogspot.in/2009/05/page-refresh.html (this is for ms crm 4.0, but you can write function in same way for ms crm 2011)


    Conatact Me
    Follow me on Twitter
    Make sure to "Vote as Helpful" and "Mark As Answer",if you get answer of your question.

  • 26. července 2012 11:41
     
     
    Hello Mahender.
    thank you very much for you fast (very fast) response.
    i will read the refernce you sent me and try to implament it on my system.
    thanks alot, i'll update on how it went.
  • 26. července 2012 12:18
     
     
    Hello Mahender.
    i understand the concept suggested ,
    but when does this jscript supposed to run ? what event triggers it ?
  • 26. července 2012 14:24
    Moderátor
     
     Navržená odpověď
    you can call your script on load of your entity and set time to call it after some interval to check update.

    Conatact Me
    Follow me on Twitter
    Make sure to "Vote as Helpful" and "Mark As Answer",if you get answer of your question.

  • 29. července 2012 9:12
     
     

    i have used the code (midified to my system and entities)
    and assigned it to run for an "OnLoad" event.
    now i have a problem of an infinite loop.

    any ideas ?

  • 29. července 2012 17:28
     
     Odpovědět Obsahuje kód

    Hi Miro,

    You can try this in the Javascript function where you are updating entity B.  After the updation, you can wait for a few seconds, say 5 or 10 seconds and then reload the form.

    //Wait for 5 seconds and reload the entity A form.

    setTimeout(function(){window.location.reload(true);}, 5000);

    Regards,

    Palani K.B.

    If you find this helpful, please mark it as answer.

    • Označen jako odpověď miro ocho 30. července 2012 8:10
    • Zrušeno označení jako odpověď miro ocho 30. července 2012 8:11
    • Označen jako odpověď miro ocho 30. července 2012 8:11
    •  
  • 30. července 2012 8:10
     
     

    Thanks !!!!!!!
    that worked out great.
    thank you guys for your help.