Advertisement
In this article we can able
to see how to get the current item id for newly created item, using REST API
and JQuery.
We are having filed with
name “RequestID” and couple of fields and having a custom button.
Call this function on
“getNewRequestItemID” button click and use the below code.
<script
type="text/javascript"
src="/Dotnetsharepoint/SP2013/SiteAssets/jquery-1.11.0.min.js"></script>
<script
type="text/javascript">
$(function () {
var listname = "YOURLISTNAME";
function
getNewRequestItemID(listname){
var currentitemid=0;
var siteURL =
_spPageContextInfo.webAbsoluteUrl;
$.ajax({
url: url,
method: "GET",
async: false,
headers: { "Accept":
"application/json; odata=verbose" },
success: function (data) {
if(data.d.results.length>0){
currentitemid = data.d.results[0].ID;
$("input[title =
'RequestID']").val(currentitemid);
}
},
error: function (data) {
}
});
}

29F09351
ReplyDeleteKaresi
Nazilli
Edremit
Çiğli
Kepez
Menderes
Kilyos
Biga
Yıldırım
The article provides a practical example of troubleshooting a SharePoint column-naming issue when working with multiple content types. The discussion shows how client-side JavaScript can be used to clear the browser-side field-name state and allow the required column creation process to continue.
ReplyDeleteThis example also demonstrates the usefulness of understanding JavaScript when working with web-based applications and troubleshooting client-side behavior. Developers who want to strengthen their JavaScript fundamentals can explore Javascript Course in Chennai for concepts and practical development skills.
The troubleshooting approach described in the article provides a useful example of how JavaScript can interact with a web application's client-side environment. Those looking for additional JavaScript learning resources can also explore Javascript Training in Chennai to build a broader understanding of JavaScript development.
ReplyDelete