Sometimes, you just want to clone a current record, and slightly change the details. e.g. some sort of config entity record. You can use the bookmarklet below, that does cloning only at the parent entity level. Once the new form is open you can change the details and save it. Drag the unminified code to your bookmarklet bar, and execute it when you have the CRM record open. The bookmarklet uses query parameters to populate the fields in the new form.
Unminified
(function() { var contentPanels = Array.from(document.querySelectorAll('iframe')).filter(function (d) { return d.style.visibility !== 'hidden' }); if (!contentPanels || contentPanels.length == 0 || !contentPanels[0].contentWindow.Xrm) { alert('CRM Form not detected'); return; } var Xrm = contentPanels[0].contentWindow.Xrm; var extraq = ''; var clientUrl = Xrm.Page.context.getClientUrl(); var entityName = Xrm.Page.data.entity.getEntityName(); Xrm.Page.data.entity.attributes.forEach(function(c){ var attributeType = c.getAttributeType(); var attributeName = c.getName(); var attributeValue = c.getValue(); if(!attributeValue || attributeName === 'createdon' || attributeName === 'modifiedon' || attributeName === 'createdby' || attributeName === 'modifiedby') return; if(attributeType === 'lookup'){ extraq += (attributeName+'name='+attributeValue[0].name+'&'); extraq += (attributeName+'type='+attributeValue[0].entityType+'&'); attributeValue = attributeValue[0].id; } if(attributeType === 'datetime'){ attributeValue = attributeValue.toDateString(); } extraq += (attributeName+'='+attributeValue+'&'); }); var newWindowUrl = clientUrl+'/main.aspx?etn='+entityName+'&pagetype=entityrecord'+'&extraqs=?'+encodeURIComponent(extraq)+'etn='+entityName; window.open(newWindowUrl, '_blank', "location=no,menubar=no,status=no,toolbar=no", false); })();
Minified
javascript:(function(){var contentPanels=Array.from(document.querySelectorAll('iframe')).filter(function(d){return d.style.visibility!=='hidden'});if(!contentPanels||contentPanels.length==0||!contentPanels[0].contentWindow.Xrm){alert('CRM Form not detected');return;} var Xrm=contentPanels[0].contentWindow.Xrm;var extraq='';var clientUrl=Xrm.Page.context.getClientUrl();var entityName=Xrm.Page.data.entity.getEntityName();Xrm.Page.data.entity.attributes.forEach(function(c){var attributeType=c.getAttributeType();var attributeName=c.getName();var attributeValue=c.getValue();if(!attributeValue||attributeName==='createdon'||attributeName==='modifiedon'||attributeName==='createdby'||attributeName==='modifiedby')return;if(attributeType==='lookup'){extraq+=(attributeName+'name='+attributeValue[0].name+'&');extraq+=(attributeName+'type='+attributeValue[0].entityType+'&');attributeValue=attributeValue[0].id;} if(attributeType==='datetime'){attributeValue=attributeValue.toDateString();} extraq+=(attributeName+'='+attributeValue+'&');});var newWindowUrl=clientUrl+'/main.aspx?etn='+entityName+'&pagetype=entityrecord'+'&extraqs=?'+encodeURIComponent(extraq)+'etn='+entityName;window.open(newWindowUrl,'_blank',"location=no,menubar=no,status=no,toolbar=no",false);})(); void 0;
I tested this only in CRMOnline on version 8.1.0.359.
End note:
This bookmarklet does not copy across the time component, if you have a datetime field with both date and time on the parent form.
Reference:
https://msdn.microsoft.com/en-us/library/gg334375.aspx#BKMK_ExampleXrmUtilityOpentEntityForm
