function PopNewCase() {
Xrm.Utility.openEntityForm("incident", "GUID_OF_EXISTING_CASE");
}
How to open an existing entity form using JavaScript in CRM?
-
03-04-2022 - |
Question
If a custom ribbon button is clicked, is it possible to open an existing entity form using JavaScript or is there some other ways to open the existing form (e.g. campaign form)?
Solution
OTHER TIPS
Yes, you can, check this link. This explains the JavaScript part. http://social.microsoft.com/Forums/en-US/crmdevelopment/thread/de870f82-a4e0-49fa-abfd-06918098c86e You need to pass entity type and record's guid into the url.
And here explains how to call a JavaScript function on ribbon button click, http://nishantrana.wordpress.com/2010/11/04/using-javascript-in-a-custom-button-in-crm-2011/
Using Visual Ribbon Editor might make things a bit easier. http://crmvisualribbonedit.codeplex.com/
edit: Example from http://msdn.microsoft.com/en-us/library/gg328483.aspx
window.open("/main.aspx?etn=account&pagetype=entityrecord&id=%7B91330924-802A-4B0D-A900-34FD9D790829%7D");
replace "account" with the entity type you want, and replace "7B91330924-802A-4B0D-A900-34FD9D790829" with the guid of the record you want.
Might use a function like this
function OpenRecord(entityName, recordId)
{
window.open("/main.aspx?etn=" + entityName + "&pagetype=entityrecord&id=%7B" + recordId + "%7D");
}