How to open an existing entity form using JavaScript in CRM?

12,106

Solution 1

function PopNewCase() { 
     Xrm.Utility.openEntityForm("incident", "GUID_OF_EXISTING_CASE"); 
}

Solution 2

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");
}
Share:
12,106
Vishnu
Author by

Vishnu

:)

Updated on June 17, 2022

Comments

  • Vishnu
    Vishnu almost 2 years

    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)?

  • Vishnu
    Vishnu about 11 years
    thanks Dav , but i need to open a Campaign Form on button click... how to do this...
  • Vishnu
    Vishnu about 11 years
    i tried function PopNewCase() { Xrm.Utility.openEntityForm("incident") } but its opening an new Case form.
  • ccellar
    ccellar about 11 years
    Keep in mind that this function is only available when Rollup 8 or later is in use. Xrm.Utility Reference