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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Pages / Set variable a value f...
Power Pages
Answered

Set variable a value from fetch that returns one record

(0) ShareShare
ReportReport
Posted on by 98

I have a fetchxml that returns one record. I put it in liquid.

The value of one field from this record has to be used further as URL for HTTP request. (ajax in javascript)

How can I do this?

Categories:
I have the same question (0)
  • Verified answer
    justinburch Profile Picture
    Microsoft Employee on at

    Hi @eliz_talent,

    I typically use hidden inputs to host singular variables like that. E.g.:

    {% assign acct = entities.account[params.id] %}
    {% if acct %}
     {% assign acctHiddenStuff = acct.new_hiddenstuff %}
    {% endif %}
    <input type="hidden" id="hiddenStuff" value="{{ acctHiddenStuff }}">

    used with 

    var hiddenStuff = $("#hiddenStuff").val();
    if (hiddenStuff !== "") {
     // do something
    }

     

  • eliz_talent Profile Picture
    98 on at

    Hi @justinburch,

    thank you for your time and the response.

    how can I assign a value if I do not have the id of the setting record (I fetch top 1 record)? 

     

    Current code does not work for me, URL remains empty:

    {% for item in settingsFetch.results.entities %}
    {% assign url = {{item.url}} %}
    {% endfor %}

  • Verified answer
    eliz_talent Profile Picture
    98 on at

    I have found a solution. I didn't give me the permission to read this entity and the fetch was empty.

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Leaderboard > Power Pages

#1
Suriyanarayanan V Profile Picture

Suriyanarayanan V 45

#2
oliver.rodrigues Profile Picture

oliver.rodrigues 14 Most Valuable Professional

#3
DP_Prabh Profile Picture

DP_Prabh 13

Last 30 days Overall leaderboard