-
Notifications
You must be signed in to change notification settings - Fork 0
/
listitemcreation.html
179 lines (158 loc) · 9.57 KB
/
listitemcreation.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
</head>
<body>
<input type="button" value="submit" id="submit">
<div id="ResultDiv"></div>
<script>
$(document).ready(function () {
$("#submit").on('click', function () {
if (SP.ClientContext != null) {
SP.SOD.executeOrDelayUntilScriptLoaded(getCurrentUser, 'SP.js');
}
else {
SP.SOD.executeFunc('sp.js', null, getCurrentUser);
}
function getCurrentUser() {
//Summary tab
//client&scope section
var Customer = $("#ddlCustomer").find(":selected").text();
var ContractRef = $("#txtContractRef").val();
var AgreementName = $("#txtAgreementName").val();
var OpportunityNo = $("#txtOpportunityNo").val();
var Region = $("#ddlRegion").find(":selected").text();
var Sector = $("#ddlSector").find(":selected").text();
var CustomerLegalEntity = $("#txtCustomerLegalEntity").val();
var WLTLegalEntity = $("#ddlWLTLegalEntity").find(":selected").text();
var ContractSigned = $("#ddlContractSigned").find(":selected").text();
var WLTExclusivity = $("#ddlWLTExclusivity").find(":selected").text();
var CodeofConductAgreed = $("#ddlCodeofConductAgreed").find(":selected").text();
var MasterContractOther = $("#ddlMasterContractOther").find(":selected").text();
//term section
var ContractType = $("#ddlContractType").find(":selected").text();
var OriginalOperationsCommenced = $("#ddlOriginalOperationsCommenced").find(":selected").text();
var StartDate = $("#dtpStartDate").val();
var IntitialTerm = $("#txtIntitialTerm").val();
var NoticePeriod = $("#txtNoticePeriod").val();
var NextEndBreakDate = $("#dtpNextEndBreakDate").val();
var ExtensionTerm = $("#txtExtensionTerm").val();
var Afterenddateextensionallowed = $("#ddlAfterenddateextensionallowed").find(":selected").text();
var MaxNumberofExtensions = $("#ddlMaxNumberofExtensions").find(":selected").text();
var LastNoticeDate = $("#dtpLastNoticeDate").val();
//Location & Key Contacts section
var Country = $("#ddlCountry").find(":selected").text();
var AccountManager = $("#pplAccountManager").val();
var PrimarySiteFacility = $("#txtPrimarySiteFacility").val();
var FinanceManager = $("#pplFinanceManager").val();
var AdditionalLocations = $("#tareaAdditionalLocations").val();
var ContractSiteManager = $("#pplContractSiteManager").val();
var LegalServicesContact = $("#pplLegalServicesContact").val();
var SummaryOtherContactsEmail = $("#tareaSummaryOtherContactsEmail").val();
var SummaryComments = $("#tareaSummaryComments").val();
//detail tab
//Invoicing section
var LocalCurrency = $("#ddlLocalCurrency").find(":selected").text();
var InvoicingCurrency = $("#ddlInvoicingCurrency").find(":selected").text();
var ChargingMechanism = $("#ddlChargingMechanism").find(":selected").text();
var InvoiceFrequency = $("#ddlInvoiceFrequency").find(":selected").text();
var ContractualPaymentTerms = $("#txtContractualPaymentTerms").val();
var WLTlatepaymentcharge = $("#ddlWLTlatepaymentcharge").find(":selected").text();
var LatePaymentInterest = $("#ddlLatePaymentInterest").find(":selected").text();
var PaymentTerm = $("#txtPaymentTerm").val();
//Performance (Annual) section
var Revenue = $("#txtRevenue").val();
var Profit = $("#txtProfit").val();
//Commercial, Revenue & Profit section
var ExpectedRevenue = $("#txtExpectedRevenue").val();
var ExpectedProfit = $("#txtExpectedProfit").val();
var InflationPriceChargeRecovery = $("#ddlInflationPriceChargeRecovery").find(":selected").text();
//Liabilities section
var GeneralDirectLosses = $("#ddlGeneralDirectLosses").find(":selected").text();
var ProductStockDirectLosses = $("#ddlProductStockDirectLosses").find(":selected").text();
var ProductStockOwner = $("#ddlProductStockOwner").find(":selected").text();
var IndirectConsequentialDamages = $("#txtIndirectConsequentialDamages").val();
var InsuranceRequirements = $("#ddlInsuranceRequirements").find(":selected").text();
var Indemnification = $("#ddlIndemnification").find(":selected").text();
//Service section
var ServiceLines = $("#ddlServiceLines").find(":selected").text();
var Obligations = $("#ddlObligations").find(":selected").text();
var KPISLAFailurePenalty = $("#ddlKPISLAFailurePenalty").find(":selected").text();
var WLTClientSoftware = $("#ddlWLTClientSoftware").find(":selected").text();
//Employee section
var PreemploymentScreening = $("#ddlPreemploymentScreening").find(":selected").text();
var TransferringInEmployeeIndemnity = $("#ddlTransferringInEmployeeIndemnity").find(":selected").text();
var RedundancyRecovery = $("#ddlRedundancyRecovery").find(":selected").text();
var TransferringOutEmployeeIndemnity = $("#ddlTransferringOutEmployeeIndemnity").find(":selected").text();
var RecruitementFee = $("#ddlRecruitementFee").find(":selected").text();
//Termination section
var TerminationNotification = $("#ddlTerminationNotification").find(":selected").text();
var TerminationProvisions = $("#ddlTerminationProvisions").find(":selected").text();
var TerminationRights = $("#ddlTerminationRights").find(":selected").text();
var TerminationPenalties = $("#txtTerminationPenalties").val();
var DetailComments = $("#tareaDetailComments").val();
var clientContext = new SP.ClientContext.get_current();
var oWeb = clientContext.get_web();
var list = oWeb.get_lists().getByTitle('CDB');
var newItem = new SP.ListItemCreationInformation();
var listItem = list.addItem(newItem);
listItem.set_item('Title', 'sample');
listItem.set_item('',);
listItem.update();
clientContext.executeQueryAsync(onSuccess,onFailure);
}
function onSuccess() {
$("#ResultDiv").empty();
$("#ResultDiv").append('New Item created successfully');
}
function onFailure(sender, args) {
alert('Failed: ' + args.get_stackTrace());
}
});
});
</script>
<!--script>
$(document).ready(function(){
$("#submit").on('click',function(){
execute();
});
function execute(){
$.ajax({
url: _spPageContextInfo.webAbsoluteUrl + "/_api/web/Lists/GetByTitle('CDB')/items",
type: "POST",
body: JSON.stringify
({
__metadata:
{
type: "SP.Data.CDBListItem"
},
Title: 'Test1'
}),
headers:
{
"Accept": "application/json;odata=verbose",
"Content-Type": "application/json;odata=verbose",
"X-RequestDigest": $("#__REQUESTDIGEST").val(),
"IF-MATCH": "*"
},
cache: false,
success: function(data)
{
$("#ResultDiv").empty();
$("#ResultDiv").append("Item created successfully!!");
},
error: function(data)
{
$("#ResultDiv").empty().text(data.responseJSON.error);
}
});
}
});
</script-->
</body>
</html>