javascript - Refresh form (Ctrl+F5) doesn't fire Retrieve Plugin in CRM 2011 -
i need update entity1 based on creation of entity2 (math calculation) while form of entity1 open.
when refresh entity1 form, field has old value until close , open entity1 form (the caching issue).
i found out doesn't fire retrieve plugin. there way overcome issue refreshing form?
first , foremost: latest crm has xrm.page.data.refresh() update form data "automagically" (not mention fact fields self-refresh when changed via plugins). 
if upgrading not option, i'd setup "watcher" function this:
// attach form load event function keepyourfieldinsync() {         setinterval(function(){         var current = xrm.page.getattribute("yourfield");          // not shown here, updated value server         var fetched = fetch_yourfield_value_from_odata_or_soap();                  if(fetched != current){             xrm.page.getattribute("yourfield").setvalue(fetched);              // if users aren't allowed set field hand, i'd include             // , customize field readonly             xrm.page.getattribute("yourfield").setsubmitmode("never");         }     }, 1000); // keep above 500 avoid killing browser }   i use "trick" recognize status changes in quotes (another user activate while user working on draft) , works quite well.
Comments
Post a Comment