daryllabar / DLaB.Xrm.XrmToolBoxTools

Plugins for the XrmToolBox
MIT License
78 stars 70 forks source link

DLaB.AttributeManager form event still exists after delete attribute #68

Open mghohoo opened 7 years ago

mghohoo commented 7 years ago

Deleting an attribute( lookup?) may cause hanging.It gets loop of 'Loading business logic'. I debug in JsProvider.ashx?bundle=FormControlBundle&ids=1223231347-405283869 when it run this step $v_3.addOnChange( $v_2 attribute missing),it throws an error. I found in the file named customizations.xml of soluation package.(crms_awp_item_no is deleted.) Remove this line,repack and import package.Then, the problem is sloved. Thanks.

daryllabar commented 7 years ago

So you have an onChange event defined in a form for a lookup attribute, and the tool was able to delete that attribute without cleaning the onChange event for the attribute on the form?

mghohoo commented 7 years ago

I defined on change event for a lookup attribute.the tool delete the attribute leaving the event in the form.but it may cause hanging 'Loading business logic'. thanks

daryllabar commented 7 years ago

So this is a request for the tool to remove field level onChanges, defined in the forms correct?

mghohoo commented 7 years ago

Maybe there is misunderstanding.The form that I created in official CRM form editor(web) worked well before.I found that deleting might cause request hanging.I can use regex to mark and remove all deleted attributes in customizations.xml to solve hanging.But I thought that the hanging issue might make users understood.

daryllabar commented 7 years ago

Let me see if I understand:

  1. You added a field, "new_MyField" to Entity X.
  2. You added in the Form editor, an OnChange Javascript event for "new_MyField".
  3. You then deleted the "new_MyField" from Entity X using the Attribute Manager
  4. The "new_MyField" onChange Event still existed in the form editor
  5. When users loaded the form, it caused it to hang because "new_MyField" doesn't exist anymore.

Is that what happened?

mghohoo commented 7 years ago

yes

daryllabar commented 7 years ago

I always use JS to create my onChange functions, never the form editor, which is probably why I haven't ran into this issue.

mghohoo commented 7 years ago

Thanks to your attritute manager,it make my job to be high efficiency.I also modify it's source to add bulk delete(no public release because of my ugly implementation).I think this function may help developers a lot.Because of short work plan,I just simply parse csv file to get the deleting aittributes and delete them.I hope that bulk delete is a good idea for attribute manager. Thanks.

daryllabar commented 7 years ago

@mghohoo, I'm always open to pull requests. If you take time to clean up your code to a point that you're satisfied, feel free to send it my why. (although I'm a little concern that you are creating so many attributes that you have to bulk delete them ;)

mghohoo commented 7 years ago

👍 because I am rewriting a crm product