Skip to main content

Notifications

Microsoft Dynamics CRM (Archived)

JavaScript in MS CRM

Posted on by Microsoft Employee

How do we create a record in another entity by invoking a javascript in the current entity ?

My requirement is as follows :-

I have two entities "Bid packages" and "Commitments", i need to create a button on "Bid packages" and on click of that button , create a new record in the "Commitment" and then fill up the look up field in "Bid packages" with the newly created record name of the "Commitment"

*This post is locked for comments

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: JavaScript in MS CRM

    Thanks it worked :)

  • Suggested answer
    Aric Levin Profile Picture
    Aric Levin 30,188 on at
    RE: JavaScript in MS CRM

    There are a few ways to do this, but let's start with the basics.

    The first thing that you need to do is create the button. In order to create the button on the Command Bar, you will need to use Ribbon Workbench (you can use it from XRMToolbox or download it from www.develop1.net/.../ribbonworkbench.aspx)

    Once the solution is installed, create a new button in your entity, and customize its command to use a JavaScript command. Provide the name of your JavaScript web resource file and the name of the function that you will use to create the new record.

    //

    The second part is to create the related record. The two main ways that you can do this are using webapi and actions.

    although you can write webapi code directly, I would recommend, especially for starters to use one of the packages webapi libraries out there. There is one from ZACRMGuy and one from David Yack:

    github.com/.../Xrm.Tools.CRMWebAPI

    sdkwebapi.codeplex.com

    //

    You can also do the same logic using actions (which can be used similar to a Workflow or Plugin). In order to call an action

    from JavaScript, you should use the process.js JavaScript library. This can be downloaded from: github.com/.../processjs

    Hope all this helps get you to the solution you need.

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Community AMA December 12th

Join us as we continue to demystify the Dynamics 365 Contact Center

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,253 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,188 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans