Lesson618 - Power Pages - Web API Simple Create Form - Power Apps 1000 Videos

preview_player
Показать описание
Description- This video covers Power Pages - Web API Simple Create Form - 618/1000 Power Apps Videos
Комментарии
Автор

Switch To Environment


Portal management
From left click Site Settings

Add
Name - Webapi/contact/enabled
Value - true
Add
Name - Webapi/contact/fields
Value - *
Add
Name - Webapi/error/innererror
Value - true

add permissons
contact - Permisson2
select contact

create web template
WebTemplate_SimpleForm2

Create Page template
PageTemplate_SimpleForm2

Create page

Page_SimpleForm2

<div class="container" style="margin: 100px">
<div style="float:right">
<input type="text" id="fname" name="fname">
<input type="text" id="lname" name="lname">
<input type="text" id="email" name="email">
<input type="text" id="phone" name="phone">


<button id="createContactNew" class="btn btn-success btn-large" onclick="createRecord();">
<i class="glyphicon glyphicon-plus"></i>Create
</button>
</div>
<div id="processingMsg" class="alert alert-warning" role="alert">
<span class="glyphicon
</div>
</div>

<script>
(function(webapi, $) {
function safeAjax(ajaxOptions) {
var deferredAjax = $.Deferred();
{
if (!ajaxOptions.headers) {
$.extend(ajaxOptions, {
headers: {
"__RequestVerificationToken": token
}
});
} else {
= token;
}
$.ajax(ajaxOptions).done(function(data, textStatus, jqXHR) {
validateLoginSession(data, textStatus, jqXHR, deferredAjax.resolve);

}).fail(function() {
deferredAjax.rejectWith(this, arguments);
});
return deferredAjax.promise();
}
webapi.safeAjax = safeAjax;
})(window.webapi = window.webapi || {}, jQuery)
var globalArray = [];

// To create new contact
function createRecord() {

var txtfname =
var fname = txtfname.value;
var txtlname =
var lname = txtlname.value;
var txtemail =
var email = txtemail.value;
var txtphone =
var phone = txtphone.value;

var recordObj = {
"firstname": fname,
"lastname": lname,
"emailaddress1": email,
"telephone1": phone
};
= "Creating record...";
webapi.safeAjax({
type: "POST",
url: "/_api/contacts",
contentType: "application/json",
data: JSON.stringify(recordObj),
success: function(res, status, xhr) {
= "Records created successfully. Refresh the page. ID:" +
}
});
}

</script>

PowerAppsVideos-ebpt
welcome to shbcf.ru