Skip to main content

Notifications

Announcements

No record found.

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.

  • 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

Daivat Vartak – Community Spotlight

We are honored to recognize Daivat Vartak as our March 2025 Community…

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Kudos to the February Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 293,238 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 231,923 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156 Moderator

Leaderboard

Product updates

Dynamics 365 release plans