web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Customer experience | Sales, Customer Insights,...
Unanswered

Not able to pass parameters to existing record using Xrm.navigation.openForm nor Xrm.Utility.openEntityForm

(0) ShareShare
ReportReport
Posted on by 15

Hello,

I have been trying to set a text field with a value for an existing record using Xrm.Utility.openEntityForm and Xrm.Navigation.openForm but the field is still not getting set.

This is my code, I am applying it to a system view and it works fine when I try to create a new record but it does not update any existing records as the parameters are not passed as the cmdbar is still visible.

I passed the selectedControlSelectedItemReferences CRM parameter from the ribbon workbench and I am using the recordID to navigate to the record I am trying to update.

Here is my code.

function setTextField(selectedItem){

parameters["mci_casereopeningreason"] = "ANY RANDOM DATA";

parameters["cmdbar"] = false;

Xrm.Utility.openEntityForm("incident", selectedItem[0].Id, parameters);

}


Thanks in advance.

I have the same question (0)
  • Kipetcoff Profile Picture
    1,037 on at

    Are you sure that you can use this method for existing record?

    https://docs.microsoft.com/en-us/dynamics365/customerengagement/on-premises/developer/set-field-values-using-parameters-passed-form

  • Kunal Sharma 2019 Profile Picture
    on at

    which client UCI or web Client ?  also make sure you have the field on the form

  • Mohamed Elshaer Profile Picture
    15 on at

    Yes. I did it using the following code, but still not setting the value of the field right.

    var entityFormOptions = {};

    entityFormOptions["openInNewWindow"] = false;

    entityFormOptions["entityName"] = "incident";

    entityFormOptions["entityId"] = selectedItem[0].Id;

    var parameters = {};

    parameters["mci_casereopeningreason"] = "ANY RANDOM DATA";

    Xrm.Navigation.openForm(entityFormOptions,parameters).then(

      function (success) {

          console.log(success);

      },

      function (error) {

          console.log(error);

      });

  • Mohamed Elshaer Profile Picture
    15 on at

    web client, and I am sure I the field on the form.

    My problem is that it sets the field when open new record form, yet fails to set it when opening existing record.

  • Community Member Profile Picture
    on at

    Hi,

    On MS documentation says:

    • The successCallback function is not executed when you open a form for an existing or new record.
    • The successCallback function is executed only when you save a record in a quick create form that was opened using the openForm method.

    Link: https://docs.microsoft.com/en-gb/powerapps/developer/model-driven-apps/clientapi/reference/xrm-navigation/openform

  • Mohamed Elshaer Profile Picture
    15 on at

    After doing some debugging, I found that my successCallback function is getting called and my console.log(success); line actually prints in my console.

    But anyways, I do not update the record in my success function, I do it in the calling function call itself.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > Customer experience | Sales, Customer Insights, CRM

#1
Tom_Gioielli Profile Picture

Tom_Gioielli 108 Super User 2025 Season 2

#2
Jimmy Passeti Profile Picture

Jimmy Passeti 50 Most Valuable Professional

#3
Gerardo Rentería García Profile Picture

Gerardo Rentería Ga... 49 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans