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)

Is it possible to get data using ajax

(0) ShareShare
ReportReport
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

I have the same question (0)
  • Suggested answer
    Shaminderpal Singh Profile Picture
    1,565 on at

    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

  • sahara Profile Picture
    645 on at

    Hey Shaminder

    can you please add a link to your answer ?

  • Suggested answer
    ARIFNIIT Profile Picture
    1,391 on at

    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

  • Parashuram  Profile Picture
    381 on at

    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

  • Community Member Profile Picture
    on at

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

  • Ama AMV Profile Picture
    88 on at

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

  • Suggested answer
    ARIFNIIT Profile Picture
    1,391 on at

    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 

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