I am trying to populate the list column with calculated value in code below.
While the alert & messages show the value being assigned to variable correctly but somehow field is not getting populated with that value.
<script type="text/javascript">
var clientContext = null;
var web = null;
var count = null;
var list ;
ExecuteOrDelayUntilScriptLoaded(Initialize, "sp.js");
function Initialize()
{
clientContext = new SP.ClientContext.get_current();
web = clientContext.get_web();
list = web.get_lists().getByTitle("Data Setup");
clientContext.load(list);
clientContext.executeQueryAsync(Function.createDelegate(this, this.onListItemsLoadSuccess),
Function.createDelegate(this, this.onQueryFailed));
}
function onListItemsLoadSuccess(sender, args) {
var count = list.get_itemCount();
alert("Total item count in the list: " + count);
var AutoIncremental = "MAA-SR-" + count;
$("input[title^='*Request ID*']").val(AutoIncremental);
$("input[title^='*Request ID*']").attr('disabled', 'disabled');
}
function onQueryFailed(sender, args) {
alert('request failed ' + args.get_message() + '\n' + args.get_stackTrace());
}
</script>