Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics CRM (Archived)

Javascript

Posted on by Microsoft Employee

Hi,

My requirement is when i create a "contact name " in contact entity at the same time create "account name" in account entity

Given below write my code its showing error please someone  refer and help me.

function createAccount() {

var account = {};

account.Name = Xrm.Page.getAttribute("fullname").getValue();



XrmServiceToolkit.Rest.Create(
account, "AccountSet", function (result) {
accountId = result.AccountId;

}
function (error) {
equal(true, false, error.message);
},
false
);
}

Thanks,

Naresh.

*This post is locked for comments

  • Dhanabal Profile Picture
    Dhanabal 230 on at
    RE: Javascript

    Hi Naresh,

    XrmServiceToolkit.Rest.Create(

    account, "AccountSet", function (result) {

    accountId = result.AccountId;

    },

    you need to do mention comma after curly braces...check it out

    ---Dhan

  • Verified answer
    Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Javascript

    Hi Ravi,

    Thanks so much for your help.

    Thanks,

    Naresh.

  • Verified answer
    RaviKashyap Profile Picture
    RaviKashyap 55,410 on at
    RE: Javascript

    Ohh great!

    if you are looking for odata/ web api client scripting, I would suggest you to download & use this tool. This will give you options to see the web api request, code and also execute it on demand. You can then ask specific question as you go along.

    github.com/.../CRMRESTBuilder

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Javascript

    Hi Ravi,

    I need to to improve my coding skills that,s why i am practicing  java script.

    Thanks,

    Naresh.

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Javascript

    Hi Ravi,

    is it possible on OData?

  • Verified answer
    RaviKashyap Profile Picture
    RaviKashyap 55,410 on at
    RE: Javascript

    Hi Naresh,

    If your requirement is to create account record when a contact is created than you can use workflows. You don't need JavaScript for this.

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!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

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

#2
Martin Dráb Profile Picture

Martin Dráb 230,214 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans