lastDigYear = Math.floor((Math.random() * 6) + 1);
lastDigMonth = Math.floor((Math.random() * 8) + 1);
AllDigDay = Math.floor((Math.random() * 15) + 1);
TolastDigYear = lastDigYear + 1;
TolastDigMonth = lastDigMonth + 1;
ToAllDigDay = AllDigDay + 3;
var data2 = {
__metadata: { ‘type’: ‘SP.Data.Form70ListItem’ },
Title: ‘Please provide title here’,
ReportingPeriodFrom: ‘201’+lastDigYear.toString()+’-0’+lastDigMonth.toString()+’-‘+AllDigDay.toString()+’T15:18:21.135Z’,
ReportingPeriodTo: ‘201’+TolastDigYear.toString()+’-0’+TolastDigMonth.toString()+’-‘+ToAllDigDay.toString()+’T15:18:21.135Z’,
PartSources: Math.floor((Math.random() * 100) + 1),
ActivePermits: Math.floor((Math.random() * 100) + 1),
InitialPermitsPeriod: Math.floor((Math.random() * 100) + 1),
InitialPermits18Months: Math.floor((Math.random() * 100) + 1),
RegionId: Math.floor((Math.random() * 10) + 1),
PermitAuthId: Math.floor(Math.random()*(158-42+1)+42),
OutstandingInitialApps: Math.floor((Math.random() * 100) + 1),
OutstandingRenewalPermits: Math.floor((Math.random() * 100) + 1),
SignificantModPeriod: Math.floor((Math.random() * 100) + 1),
SignificantMods18Months: Math.floor((Math.random() * 100) + 1),
OutstandingSignficantMods: Math.floor((Math.random() * 100) + 1),
Form70comments: ‘Contrary to popular belief, Lorem Ipsum is not simply random text. It has roots in a piece of classical Latin literature from 45 BC, making it over 2000 years old. Richard McClintock, a Latin professor at Hampden’,
};
$.ajax({
url: “/_api/web/lists/GetByTitle(‘Form70’)/items”,
type: “POST”,
data: JSON.stringify(data2),
headers: {
“X-RequestDigest”: $(“#__REQUESTDIGEST”).val(),
“accept”: “application/json; odata=verbose”,
“content-type”: “application/json;odata=verbose”
}
}).done(function () {
console.log(“Done”);
}).fail(function () {
console.log(“FaiL”);
});