Answered by:
Opening a Form Programmatically Using JavaScript?

Question
-
Hello all,
Is it possible to open up a selected record's Information form through a JavaScript call? And can parameters/global variables be passed to it?
Thanks in advance for any responses.
Kirk Roerig
- Edited by Kirk Roerig Thursday, May 24, 2012 8:33 PM
Thursday, May 24, 2012 7:51 PM
Answers
-
You could use this kind of link to open a form:
http://server/organization/main.aspx?etc=2&extraqs=formid%3d56cc145d-edb9-4c9e-b1c0-11a710e29578&id=%7b8E11CB29-999B-E111-98CE-0050568C0079%7d&pagetype=entityrecord
There are two id-s there: entity ID and form Id (and etc, which is, essentially, an entity type id).
Basically, just go to a CRM record, click "copy a link" button, and you'll get the link you can use as a template for all other records of the same type. Then, replace "id" parameter with the id of the record you want to open and use something like
window.open(<record_url>)
As for passing additional parameters to the form, I don't think it's possible. You could, though, add a special field to your entity that you would use to pass the parameters. In that case, you would have to update the field using more javascript before opening the form.
Alex Shlega, GotchaHunter.Net
- Marked as answer by Kirk Roerig Thursday, May 24, 2012 8:51 PM
Thursday, May 24, 2012 8:37 PM -
You can define approved custom parameters for each form. See Configure a Form to Accept Custom Querystring Parameters.
Also see:
Jim Daly Technical Writer Microsoft Dynamics CRM
- Proposed as answer by Alex ShlegaMVP Friday, May 25, 2012 4:18 AM
- Marked as answer by Kirk Roerig Tuesday, May 29, 2012 12:23 PM
Thursday, May 24, 2012 10:00 PMAnswerer
All replies
-
You could use this kind of link to open a form:
http://server/organization/main.aspx?etc=2&extraqs=formid%3d56cc145d-edb9-4c9e-b1c0-11a710e29578&id=%7b8E11CB29-999B-E111-98CE-0050568C0079%7d&pagetype=entityrecord
There are two id-s there: entity ID and form Id (and etc, which is, essentially, an entity type id).
Basically, just go to a CRM record, click "copy a link" button, and you'll get the link you can use as a template for all other records of the same type. Then, replace "id" parameter with the id of the record you want to open and use something like
window.open(<record_url>)
As for passing additional parameters to the form, I don't think it's possible. You could, though, add a special field to your entity that you would use to pass the parameters. In that case, you would have to update the field using more javascript before opening the form.
Alex Shlega, GotchaHunter.Net
- Marked as answer by Kirk Roerig Thursday, May 24, 2012 8:51 PM
Thursday, May 24, 2012 8:37 PM -
Perfect, thanks for the response Alex!
Kirk Roerig
Thursday, May 24, 2012 8:52 PM -
You can define approved custom parameters for each form. See Configure a Form to Accept Custom Querystring Parameters.
Also see:
Jim Daly Technical Writer Microsoft Dynamics CRM
- Proposed as answer by Alex ShlegaMVP Friday, May 25, 2012 4:18 AM
- Marked as answer by Kirk Roerig Tuesday, May 29, 2012 12:23 PM
Thursday, May 24, 2012 10:00 PMAnswerer -
Excellent, thank you Jim this solves my dilemma.
Kirk Roerig
Tuesday, May 29, 2012 12:24 PM