Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics CRM (Archived)

Is it possible to get data using ajax

Posted on by 645

I have a JS function that using ajax to fire a function in server side, on the server side I create a record and I need to get the new GUID of the new record by using the guid I want to open the specific record. Can I transfer the guid that was created in the server side to the client side (client side) ? is it possible and supported? 

*This post is locked for comments

  • Suggested answer
    ARIFNIIT Profile Picture
    ARIFNIIT 1,391 on at
    RE: Is it possible to get data using ajax

    AMA AMV: you can input parameters in Action using JavaScript and you can use it in custom action. 

    refer below article

    https://community.dynamics.com/crm/b/crminogic/archive/2016/12/20/execute-action-with-entitycollection-parameter-using-web-api-in-dynamics-365 

  • Ama AMV Profile Picture
    Ama AMV 80 on at
    RE: Is it possible to get data using ajax

    Hi, how can we send the data to the c# code?

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Is it possible to get data using ajax

    Hi this can be done using standard javascript on a promise. The create script will return your Guid natively.

  • Parashuram  Profile Picture
    Parashuram 381 on at
    RE: Is it possible to get data using ajax

    Hi Sahara,

        I assume that you are trying this ajax call in web resource and in c# code you might have written function to create record.If that is the case you can call the Web api with action return type json :

    e.g.

    jQuery.ajax({

        type: "GET",

        url: 'api.geonames.org/postalCodeLookupJSON;country=AT&username=demo',

        dataType: "jsonp",

        cache: false,

        crossDomain: true,

        processData: true,

        success: function (data) {

            alert(JSON.stringify(data));

        },

        error: function (XMLHttpRequest, textStatus, errorThrown) {

            alert("error");

        }

    });

    Hope this helps,

    Parashuram Jadhav

  • Suggested answer
    ARIFNIIT Profile Picture
    ARIFNIIT 1,391 on at
    RE: Is it possible to get data using ajax

    You can use custom action and call it through Ajax call.

    Refer below link

    community.dynamics.com/.../use-javascript-to-call-a-custom-action-and-to-display-an-error

  • sahara Profile Picture
    sahara 645 on at
    RE: Is it possible to get data using ajax

    Hey Shaminder

    can you please add a link to your answer ?

  • Suggested answer
    Shaminderpal Singh Profile Picture
    Shaminderpal Singh 1,565 on at
    RE: Is it possible to get data using ajax

    Hi Sahara,

    Yes you can do it,however your serverside fn has to be an action which after creation should return an output parameter of type entityreference.You can invoke your action using xmlhttprequest /Ajax.

    -Shaminder

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,235 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans