Sticky

This blog has moved to www.dreamingincrm.com. Please update your feed Url. Thank you.

Showing posts with label bookmarklet. Show all posts
Showing posts with label bookmarklet. Show all posts

28 January 2015

Bookmarklet to copy FetchXml

This is basically an extension of this post -> http://nycrmdev.blogspot.com.au/2014/12/using-advanced-find-fetchxml-capability.html. The bookmarklet below displays fetchxml that was used to display the results.

javascript:var fetchXml;if(frames[0]&&frames[0].document.getElementById('FetchXml')){fetchXml=frames[0].document.getElementById('FetchXml').value;} else if(frames[1]&&frames[1].document.getElementById('FetchXml')){fetchXml=frames[1].document.getElementById('FetchXml').value;} if(fetchXml){window.prompt('FetchXml',fetchXml);} else{alert('No FetchXml query found');} void 0;

Run this bookmarket from the Advanced Find results page and it will display the FetchXml in a dialog window for copy pasting.



Sometimes I just want to develop a starting point fetchxml using advanced find and work on it more using FetchXml Builder or Fetch Tester 3000. This bookmarklet saves me the hassle of exporting the fetchxml file, and copy pasting the result into the appropriate tool.

17 October 2014

Copy Record Id of a row from Advanced Find

I have recently started using bookmarklets to improve productivity during CRM Development. There are plenty of bookmarklets that I use, and of these I quite frequently use these:
  1. Copy Record Id (http://blog.sonomapartners.com/2014/01/crm-2013-javascript-bookmark-series-part-1.html)
  2. Open Advanced Find (http://www.magnetismsolutions.com.au/blog/paulnieuwelaar/2014/07/24/crm-2013-open-advanced-find-from-anywhere-with-bookmarklet)
  3. Open Default Solution (http://www.magnetismsolutions.com.au/blog/paulnieuwelaar/2014/07/27/customize-and-publish-from-crm-2013-forms-with-bookmarklets)
Inorder to use the Copy Record Id bookmarket you'll have to be in the record form. I found this inconvinient when I was viewing the results from Advanced Find. You can bookmarklet the below script to quickly extract the primary key of the selected row in the Advanced Find resultset.

javascript:var contentFrame=document.getElementById('contentIFrame0'),isError=false;if(contentFrame){var resultFrame=contentFrame.contentWindow.document.getElementById('resultFrame');if(resultFrame&&resultFrame.contentWindow){var selectedRow=resultFrame.contentWindow.document.querySelector('.ms-crm-List-SelectedRow');if(selectedRow){window.prompt('Copy to clipboard: Ctrl+C, Enter',selectedRow.getAttribute('oid'));}
else{alert('Please select a row to get the id');}}else{isError=true;}}else{isError=true;}
if(isError){alert('Unable to locate result frame to extract rowid');}
void 0;

Here is the how it looks when you run the code on a row in the advanced find result.


I have tested this in the latest version of Firefox (33) and Chrome (38) and it works.