Xrm.Navigation.openForm not honouring formid in Unified Interface
I have been using the technique in the following post:
Xrm.Navigation.openForm not honouring formid
which has beeen working great in the Classic Interface.
I have updated my JavaScript to the following:
function OpenSpecificForm(primaryControl)
{
const FORMID = "A696976B-EA8A-42F3-B4DC-F35DC9204D58";
var formContext = primaryControl;
var parameters = { formid: FORMID };
var entityFormOptions = {};
entityFormOptions["entityName"] = "new_entity_name";
var recordId = formContext.data.entity.getId();
var recordName = formContext.getAttribute("new_name").getValue();
if (recordId != null) { parameters["new_targetentityfieldid"] = recordId; }
if (recordName != null) { parameters["new_targetentityfieldname"] = recordName; }
Xrm.Navigation.openForm(entityFormOptions, parameters);
}
and set ribbon workbench as follows:
Crm Parameter
This code continues to work as expected in the Classic UI but doesnt seem to work in the new Unified Interface. The entity form opens but opens the last one CRM remembers and NOT the one I have specified in the formId.
Has anyone managed to open a specific form in the new UI?
javascript dynamics-crm dynamics-crm-365-v9 dynamics-crm-uci
add a comment |
I have been using the technique in the following post:
Xrm.Navigation.openForm not honouring formid
which has beeen working great in the Classic Interface.
I have updated my JavaScript to the following:
function OpenSpecificForm(primaryControl)
{
const FORMID = "A696976B-EA8A-42F3-B4DC-F35DC9204D58";
var formContext = primaryControl;
var parameters = { formid: FORMID };
var entityFormOptions = {};
entityFormOptions["entityName"] = "new_entity_name";
var recordId = formContext.data.entity.getId();
var recordName = formContext.getAttribute("new_name").getValue();
if (recordId != null) { parameters["new_targetentityfieldid"] = recordId; }
if (recordName != null) { parameters["new_targetentityfieldname"] = recordName; }
Xrm.Navigation.openForm(entityFormOptions, parameters);
}
and set ribbon workbench as follows:
Crm Parameter
This code continues to work as expected in the Classic UI but doesnt seem to work in the new Unified Interface. The entity form opens but opens the last one CRM remembers and NOT the one I have specified in the formId.
Has anyone managed to open a specific form in the new UI?
javascript dynamics-crm dynamics-crm-365-v9 dynamics-crm-uci
Have you tried with "formId" instead of "formid"? The parameter name changed when Xrm.Utility.openEntityForm was replaced by Xrm.Navigation.openForm
– Federico Jousset
Nov 21 '18 at 9:31
Thanks for replying, unfortunately changing the parameter to formId doesn't help. It stops it working in both the old and new UI.
– Bharat Premji
Nov 22 '18 at 23:29
add a comment |
I have been using the technique in the following post:
Xrm.Navigation.openForm not honouring formid
which has beeen working great in the Classic Interface.
I have updated my JavaScript to the following:
function OpenSpecificForm(primaryControl)
{
const FORMID = "A696976B-EA8A-42F3-B4DC-F35DC9204D58";
var formContext = primaryControl;
var parameters = { formid: FORMID };
var entityFormOptions = {};
entityFormOptions["entityName"] = "new_entity_name";
var recordId = formContext.data.entity.getId();
var recordName = formContext.getAttribute("new_name").getValue();
if (recordId != null) { parameters["new_targetentityfieldid"] = recordId; }
if (recordName != null) { parameters["new_targetentityfieldname"] = recordName; }
Xrm.Navigation.openForm(entityFormOptions, parameters);
}
and set ribbon workbench as follows:
Crm Parameter
This code continues to work as expected in the Classic UI but doesnt seem to work in the new Unified Interface. The entity form opens but opens the last one CRM remembers and NOT the one I have specified in the formId.
Has anyone managed to open a specific form in the new UI?
javascript dynamics-crm dynamics-crm-365-v9 dynamics-crm-uci
I have been using the technique in the following post:
Xrm.Navigation.openForm not honouring formid
which has beeen working great in the Classic Interface.
I have updated my JavaScript to the following:
function OpenSpecificForm(primaryControl)
{
const FORMID = "A696976B-EA8A-42F3-B4DC-F35DC9204D58";
var formContext = primaryControl;
var parameters = { formid: FORMID };
var entityFormOptions = {};
entityFormOptions["entityName"] = "new_entity_name";
var recordId = formContext.data.entity.getId();
var recordName = formContext.getAttribute("new_name").getValue();
if (recordId != null) { parameters["new_targetentityfieldid"] = recordId; }
if (recordName != null) { parameters["new_targetentityfieldname"] = recordName; }
Xrm.Navigation.openForm(entityFormOptions, parameters);
}
and set ribbon workbench as follows:
Crm Parameter
This code continues to work as expected in the Classic UI but doesnt seem to work in the new Unified Interface. The entity form opens but opens the last one CRM remembers and NOT the one I have specified in the formId.
Has anyone managed to open a specific form in the new UI?
function OpenSpecificForm(primaryControl)
{
const FORMID = "A696976B-EA8A-42F3-B4DC-F35DC9204D58";
var formContext = primaryControl;
var parameters = { formid: FORMID };
var entityFormOptions = {};
entityFormOptions["entityName"] = "new_entity_name";
var recordId = formContext.data.entity.getId();
var recordName = formContext.getAttribute("new_name").getValue();
if (recordId != null) { parameters["new_targetentityfieldid"] = recordId; }
if (recordName != null) { parameters["new_targetentityfieldname"] = recordName; }
Xrm.Navigation.openForm(entityFormOptions, parameters);
}
function OpenSpecificForm(primaryControl)
{
const FORMID = "A696976B-EA8A-42F3-B4DC-F35DC9204D58";
var formContext = primaryControl;
var parameters = { formid: FORMID };
var entityFormOptions = {};
entityFormOptions["entityName"] = "new_entity_name";
var recordId = formContext.data.entity.getId();
var recordName = formContext.getAttribute("new_name").getValue();
if (recordId != null) { parameters["new_targetentityfieldid"] = recordId; }
if (recordName != null) { parameters["new_targetentityfieldname"] = recordName; }
Xrm.Navigation.openForm(entityFormOptions, parameters);
}
javascript dynamics-crm dynamics-crm-365-v9 dynamics-crm-uci
javascript dynamics-crm dynamics-crm-365-v9 dynamics-crm-uci
edited Jan 8 at 0:46
Arun Vinoth
9,970132658
9,970132658
asked Nov 21 '18 at 8:09
Bharat PremjiBharat Premji
61
61
Have you tried with "formId" instead of "formid"? The parameter name changed when Xrm.Utility.openEntityForm was replaced by Xrm.Navigation.openForm
– Federico Jousset
Nov 21 '18 at 9:31
Thanks for replying, unfortunately changing the parameter to formId doesn't help. It stops it working in both the old and new UI.
– Bharat Premji
Nov 22 '18 at 23:29
add a comment |
Have you tried with "formId" instead of "formid"? The parameter name changed when Xrm.Utility.openEntityForm was replaced by Xrm.Navigation.openForm
– Federico Jousset
Nov 21 '18 at 9:31
Thanks for replying, unfortunately changing the parameter to formId doesn't help. It stops it working in both the old and new UI.
– Bharat Premji
Nov 22 '18 at 23:29
Have you tried with "formId" instead of "formid"? The parameter name changed when Xrm.Utility.openEntityForm was replaced by Xrm.Navigation.openForm
– Federico Jousset
Nov 21 '18 at 9:31
Have you tried with "formId" instead of "formid"? The parameter name changed when Xrm.Utility.openEntityForm was replaced by Xrm.Navigation.openForm
– Federico Jousset
Nov 21 '18 at 9:31
Thanks for replying, unfortunately changing the parameter to formId doesn't help. It stops it working in both the old and new UI.
– Bharat Premji
Nov 22 '18 at 23:29
Thanks for replying, unfortunately changing the parameter to formId doesn't help. It stops it working in both the old and new UI.
– Bharat Premji
Nov 22 '18 at 23:29
add a comment |
1 Answer
1
active
oldest
votes
I can see a couple of potential problems with your code.
The first one is related to how the form context is being generated because it actually needs to be obtained using the getFormContext method (documentation seems wrong) from the primaryControl
object:
var formContext = primaryControl.getFormContext();
The second one is the parameter is the formId parameter name, which according to documenation should be written using capital I. It might no be a problem, but remember that the json spec states the following:
All member names exchanged between the Client and the Server that are
considered for matching of any kind should be considered to be
case-sensitive. The terms function, method, and procedure can be
assumed to be interchangeable.
Hi, adding getFormContext() works in the old UI, however in the UI I get a script error: primaryControl.getFormContext is not a function.
– Bharat Premji
Nov 22 '18 at 23:31
when using the ribbon and passing the primaryControl to your js function, use the primaryControl object as though it were the formContext. See stackoverflow.com/a/54012344/44815
– Raj Rao
Jan 3 at 21:24
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53407671%2fxrm-navigation-openform-not-honouring-formid-in-unified-interface%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
I can see a couple of potential problems with your code.
The first one is related to how the form context is being generated because it actually needs to be obtained using the getFormContext method (documentation seems wrong) from the primaryControl
object:
var formContext = primaryControl.getFormContext();
The second one is the parameter is the formId parameter name, which according to documenation should be written using capital I. It might no be a problem, but remember that the json spec states the following:
All member names exchanged between the Client and the Server that are
considered for matching of any kind should be considered to be
case-sensitive. The terms function, method, and procedure can be
assumed to be interchangeable.
Hi, adding getFormContext() works in the old UI, however in the UI I get a script error: primaryControl.getFormContext is not a function.
– Bharat Premji
Nov 22 '18 at 23:31
when using the ribbon and passing the primaryControl to your js function, use the primaryControl object as though it were the formContext. See stackoverflow.com/a/54012344/44815
– Raj Rao
Jan 3 at 21:24
add a comment |
I can see a couple of potential problems with your code.
The first one is related to how the form context is being generated because it actually needs to be obtained using the getFormContext method (documentation seems wrong) from the primaryControl
object:
var formContext = primaryControl.getFormContext();
The second one is the parameter is the formId parameter name, which according to documenation should be written using capital I. It might no be a problem, but remember that the json spec states the following:
All member names exchanged between the Client and the Server that are
considered for matching of any kind should be considered to be
case-sensitive. The terms function, method, and procedure can be
assumed to be interchangeable.
Hi, adding getFormContext() works in the old UI, however in the UI I get a script error: primaryControl.getFormContext is not a function.
– Bharat Premji
Nov 22 '18 at 23:31
when using the ribbon and passing the primaryControl to your js function, use the primaryControl object as though it were the formContext. See stackoverflow.com/a/54012344/44815
– Raj Rao
Jan 3 at 21:24
add a comment |
I can see a couple of potential problems with your code.
The first one is related to how the form context is being generated because it actually needs to be obtained using the getFormContext method (documentation seems wrong) from the primaryControl
object:
var formContext = primaryControl.getFormContext();
The second one is the parameter is the formId parameter name, which according to documenation should be written using capital I. It might no be a problem, but remember that the json spec states the following:
All member names exchanged between the Client and the Server that are
considered for matching of any kind should be considered to be
case-sensitive. The terms function, method, and procedure can be
assumed to be interchangeable.
I can see a couple of potential problems with your code.
The first one is related to how the form context is being generated because it actually needs to be obtained using the getFormContext method (documentation seems wrong) from the primaryControl
object:
var formContext = primaryControl.getFormContext();
The second one is the parameter is the formId parameter name, which according to documenation should be written using capital I. It might no be a problem, but remember that the json spec states the following:
All member names exchanged between the Client and the Server that are
considered for matching of any kind should be considered to be
case-sensitive. The terms function, method, and procedure can be
assumed to be interchangeable.
answered Nov 21 '18 at 14:33
Federico JoussetFederico Jousset
1,467817
1,467817
Hi, adding getFormContext() works in the old UI, however in the UI I get a script error: primaryControl.getFormContext is not a function.
– Bharat Premji
Nov 22 '18 at 23:31
when using the ribbon and passing the primaryControl to your js function, use the primaryControl object as though it were the formContext. See stackoverflow.com/a/54012344/44815
– Raj Rao
Jan 3 at 21:24
add a comment |
Hi, adding getFormContext() works in the old UI, however in the UI I get a script error: primaryControl.getFormContext is not a function.
– Bharat Premji
Nov 22 '18 at 23:31
when using the ribbon and passing the primaryControl to your js function, use the primaryControl object as though it were the formContext. See stackoverflow.com/a/54012344/44815
– Raj Rao
Jan 3 at 21:24
Hi, adding getFormContext() works in the old UI, however in the UI I get a script error: primaryControl.getFormContext is not a function.
– Bharat Premji
Nov 22 '18 at 23:31
Hi, adding getFormContext() works in the old UI, however in the UI I get a script error: primaryControl.getFormContext is not a function.
– Bharat Premji
Nov 22 '18 at 23:31
when using the ribbon and passing the primaryControl to your js function, use the primaryControl object as though it were the formContext. See stackoverflow.com/a/54012344/44815
– Raj Rao
Jan 3 at 21:24
when using the ribbon and passing the primaryControl to your js function, use the primaryControl object as though it were the formContext. See stackoverflow.com/a/54012344/44815
– Raj Rao
Jan 3 at 21:24
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53407671%2fxrm-navigation-openform-not-honouring-formid-in-unified-interface%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Have you tried with "formId" instead of "formid"? The parameter name changed when Xrm.Utility.openEntityForm was replaced by Xrm.Navigation.openForm
– Federico Jousset
Nov 21 '18 at 9:31
Thanks for replying, unfortunately changing the parameter to formId doesn't help. It stops it working in both the old and new UI.
– Bharat Premji
Nov 22 '18 at 23:29