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

Notifications

Announcements

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Pages

#1
Fubar Profile Picture

Fubar 83 Super User 2025 Season 2

#2
Jerald Felix Profile Picture

Jerald Felix 42

#3
Lucas001 Profile Picture

Lucas001 25 Super User 2025 Season 2

Last 30 days Overall leaderboard