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 :
Microsoft Dynamics CRM (Archived)

How to get CRM Attribute value in JS function called onclick of button

(0) ShareShare
ReportReport
Posted on by 2

Hi Devs,

I have added a new button on Command Bar of a form and want to open a new record of different entity when user will click on this button.

Can you suggest me how can I get the data of any field displaying on the form.

*This post is locked for comments

I have the same question (0)
  • MarkR_B Profile Picture
    465 on at

    To open a new form you will need to add new javascript web resource. Then within this javascript create a function that is used by the button. The following code is an example of the function you will need to create.

    function openNewAccount() {

      var parameters = {};

      parameters["formid"] = "b053a39a-041a-4356-acef-ddf00182762b";

      parameters["name"] = "Test";

      parameters["telephone1"] = "(425) 555-1234";

      Xrm.Utility.openEntityForm("account", null, parameters);

    }

    So obviously you will need to substitute in your entity name and the field you want to populate.

    See msdn.microsoft.com/.../72a66f93-92df-42b9-a8fd-b6125c7fe83b for more info.

  • Verified answer
    Hosk Profile Picture
    on at

    Hello

    You need to learn how to write some Javascript, CRM 2011 and CRM 2013 are pretty much the same, so the blogs below will get you started

    This is a great page to get started

    http://www.dynamicscrmpros.com/getting-started-with-javascript-form-scripting-for-microsoft-dynamics-crm-2011/

    Javascript basics

    http://crmbusiness.wordpress.com/2011/02/17/crm-2011-javascript-xrm-page-basics/

    more basic Javascript functions

    http://www.powerobjects.com/blog/2011/01/14/crm-2011-useful-javascript-tidbits/

    This page will show you how to get some field values

    http://duanenapier.wordpress.com/2014/04/25/getting-values-from-form-fields-in-javascript-crm-2013/

  • Community Member Profile Picture
    on at

    Thanks Ben for sharing the links. 

    Harihar

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 > 🔒一 Microsoft Dynamics CRM (Archived)

#1
SA-08121319-0 Profile Picture

SA-08121319-0 4

#1
Calum MacFarlane Profile Picture

Calum MacFarlane 4

#3
Alex Fun Wei Jie Profile Picture

Alex Fun Wei Jie 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans