0% found this document useful (0 votes)
5 views3 pages

JavaScript Person Management Script

Uploaded by

hicham.sarkik
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views3 pages

JavaScript Person Management Script

Uploaded by

hicham.sarkik
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd

<html>

<head>
<script type="text/javascript" src="[Link]"></script>
<script type="text/javascript" src="[Link]"></script>
</head>
<body>

<script type="text/javascript" language="javascript">


$(document).ready(function () {

$("#run").click(function () {

log = function(msg, json) {


$('#log').before("<hr/><b>" + msg + "</b>");
$('#log').before("<pre>" + [Link](json, undefined, 2) +
"</pre>");
};

[Link](
"/Person",
{
firstName: "John",
lastName: "Smith"
},
{
systemName: "Admin"
}
).then(
function (result) {
log("PERSON CREATED:", result);
return [Link](
"/Person/" + [Link](),
{
depth: 1
}
);
}
).then(
function (result) {
log("READ CREATED PERSON:", result);
return [Link](
"/Person/" + [Link](),
{
genderCd: {
genderCode: "M"
},
TelephoneNumbers: {
item: [
{
phoneNumber: "111-11-11"
},
{
phoneNumber: "222-22-22"
}
]
}
},
{
systemName: "Admin"
}
);
}
).then(
function (result) {
log("PERSON UPDATED:", result);
return [Link](
"/Person/" + [Link](),
{
depth: 3,
readSystemFields: true
}
);
}
).then(
function (result) {
log("READ UPDATED PERSON:", result);
return [Link](
"/Person/" + [Link]() +
"/TelephoneNumbers/" + [Link][0].[Link](),
{
systemName: "Admin"
}
);
}
).then(
function (result) {
log("TELEPHONE DELETED:", result);
return [Link](
"/Person/" + [Link](),
{
depth: 3
}
);
}
).then(
function (result) {
log("READ PERSON AFTER TELEPHONE IS DELETED:", result);
return [Link](
"/Person/" + [Link](),
{
systemName: "Admin"
}
);
}
).then(
function (result) {
log("PERSON DELETED:", result);
return [Link](
"/Person/" + [Link](),
{
depth: 1,
recordStates: "ACTIVE,PENDING,DELETED",
readSystemFields: true
}
);
}
).then(
function (result) {
log("READ PERSON AFTER DELETE (HSI -1):", result);
}
);
});

});
</script>

<input type="button" id="run" value="Run..."/>


<p/>
<div id="log"></div>
</body>
</html>

You might also like