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 / How to pass dynamic va...
Power Pages
Unanswered

How to pass dynamic values into url parameters in wepapi of power portal

(0) ShareShare
ReportReport
Posted on by 265

Hi,

I have used 2 forms to handle my scenario. First form is for inserting Email and other one is for inserting OTP code. After inserting the email, Current form is hide and OTP form is displayed.  When clicking the email form submit btn , that record will be added into data verse table by using a webapi (by POST type). and also , in OTP form , User input OTP code will be validated. That is scenario is fine.it is worked. But i have a issue with passing a dynamic value into url parameters. In my code ,email is dynamic value. cr1d7_email is a query parameter. How i correct url with dynamic value? This code is not updated records in data verse table

 

function OTPValidation(){

const otp = document.getElementById('cr1d7_otp').value;

if(otp_code==otp)
{
webapi.safeAjax({

type: "PATCH",
url: "/_api/cr1d7_userotps?cr1d7_email=" &email,
contentType: "application/json",
data: JSON.stringify({
"cr1d7_isactive": "No"
}),
success: function (res) {
alert("OTP is correct");
}
});
}
else
{
alert("OTP is wrong");
}
};
 
thanks
 
 
Categories:
I have the same question (0)
  • fm_skeller Profile Picture
    277 Moderator on at

    I am assuming you want to update the record where cr1d7_userotps matches the email address you are adding to the url?
    To perform a PATCH operation, the URL needs to include the guid of the cr1d7_uersotps record as described here:
    https://learn.microsoft.com/en-us/power-pages/configure/web-api-http-requests-handle-errors#example-update-table-data 
    You could use a GET operation to retrieve the guid using the email value

    webapi.safeAjax({
    
    type: "GET",
    url: "/_api/cr1d7_userotps?$select=cr1d7_email&$filter=cr1d7_email eq" + email,
    contentType: "application/json",
    data: JSON.stringify({
    "cr1d7_isactive": "No"
    }),
    success: function (res) {
    //process result
    }
    });


    Compose HTTP requests and handle errors for portals Web API | Microsoft Learn
    Also, if cr1d7_isactive is an Yes/No field, the value should be either True/False (not "No").

     

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!

Congratulations to the April Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Pages

#1
11manish Profile Picture

11manish 56

#2
Valantis Profile Picture

Valantis 46

#3
rezarizvii Profile Picture

rezarizvii 25

Last 30 days Overall leaderboard