I am doing ribbon button for a view, the button should run an operation on each record the user sees.
e.g. If the user applies the filters to show only records with condition fieldX = valueX so the operation will be set on these records only. (with no count limitation)
for this purpose I need to get the fetchXml settings of this view. but the current, not default, because the user could change them.
How can I do it from web resource javascript file?
You can use the Ribbon Workbench to create the button on "Home". From there add a Command > Actions > JavaScript Action > Add Parameter > CRM Parameter > SelectedControlAllItemReferences
Now the JavaScript function you call will have an array of item references from the current list.
Screenshot of the Ribbon Workbench menu