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 365 | Integration, Dataverse...
Answered

JavaScript Web Resource Code Correction

(0) ShareShare
ReportReport
Posted on by

Hi,

I have an array object, The format like:

templates = [
{"templateName":"Temp001.docx","templateId":"DOC001"},
{"templateName":"Temp002.docx","templateId":"DOC002"},
{"templateName":"Temp003.docx","templateId":"DOC003"}]

I want to get templateName and templateId respectively. My JS code like:

var Name, Value;


for (var i = 0; i < templates.length; i++) {
Name = templates[i].templateName;
Value = templates[i].templateId;
alert ('Temlate Name: ' + Name, 'Template ID: ' + Value);
}


But it's not work. Could you please help to correct the code above? Thanks.

I have the same question (0)
  • Verified answer
    Bipin D365 Profile Picture
    28,983 Moderator on at

    Hi,

    It works when I try on my browser.

    Problem is with your alert

    Change to

    alert('Template Name: ' + Name + ' Template Value: ' + Value);

    IMG20221119090411.jpg

    Only thing to note is in your variable Name and Value will have last item value.

  • ALAN365 Profile Picture
    on at

    Thanks, it's work now.

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
Martin Dráb Profile Picture

Martin Dráb 49 Most Valuable Professional

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 38 Super User 2025 Season 2

#3
#ManoVerse Profile Picture

#ManoVerse 31

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans