web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :
Microsoft Dynamics 365 | Integration, Dataverse...
Answered

Retrieve Value from array using js.

(0) ShareShare
ReportReport
Posted on by 595

i have a requirement that i'm caling API from flow. From that I'm passing response back to js. That result I'm storing in ja variable.

Now I'm able to get complete result. but while I'm trying to extract particular value from result getting undefined.

Please refer screen shot attached there I'm showing result array in alert.

Screenshot-_2800_156_2900_.png

var result = this.response;
alert("" + result);
var vendor=result["Vendor"];
alert(vendor); 

code snippet.

Please help me to achieve this.

I have the same question (0)
  • Verified answer
    Wahaj Rashid Profile Picture
    11,321 on at
    RE: Retrieve Value from array using js.

    Hi,

    Thank you for your query.

    I believe the response is in JSON (not an array).

    You need to pars it as JSON using JSON.parse function.

    Here is the sample code for your reference:

    var responseText = '{"Entry_Sheet":1234,"Vendor":"000011"}';
    
    var jsonObj = JSON.parse(responseText);
    
    console.log(jsonObj.Vendor);

    An if the response is a JSON Array (starts with [), look at following example:

    var responseText = '[{"Entry_Sheet":1234,"Vendor":"000011"}]';
    
    var jsonObj = JSON.parse(responseText);
    
    // Read the object using array index
    console.log(jsonObj[0].Vendor);

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 365 | Integration, Dataverse, and general topics

#1
#ManoVerse Profile Picture

#ManoVerse 101

#2
Siv Sagar Profile Picture

Siv Sagar 93 Super User 2025 Season 2

#3
Martin Dráb Profile Picture

Martin Dráb 66 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans