2017年11月23日 星期四

[Oracle BI] Forgot password

Assume weblogic server is installed.....

cat /product/fmw/BI/user_projects/domains/BIDomain/servers/bi_server1/security/boot.properties

password={AES}.................................................................=
username={AES}rvEVZgs/uEWN8WC6M4EgTwEq/o6f/X1unADuTFNgx/s\=

cd /product/fmw/11g/oracle_common/common/bin

./wlst.sh

wls:/offline>domain = "/product/fmw/BI/user_projects/domains/BIDomain"
wls:/offline>service = weblogic.security.internal.SerializedSystemIni.getEncryptionService(domain)
wls:/offline>encryption = weblogic.security.internal.encryption.ClearOrEncryptedService(service)
wls:/offline>print "Weblogic server Admin password: %s" %encryption.decrypt("{AES}....................y3w7o=")



:-D



2017年11月15日 星期三

BI Publisher Notes

Create data source

  1. Administration on the top right corner0
  2. JDBC > Add datasource





Create data model


  1. Create data model
  2. tab diagram > new > sql query > enter name, sql and select datasource > OK
  3. tab data > view > save as sample data
  4. save on the top right corner




Create report


  1. create report
  2. select data model, if the data model does not contain sample data, error message returns, you cannot proceed
  3. keep pressing next
  4. edit report
  5. you can drag "layout grid", "text item", field name of data set, etc, to the report
  6. save on the top right corner
  7. click "return" button to exit
  8. view report
  9. click the menu button on the top right corner > export > interactive
  10. new window opens
  11. append "&id=<username>&passwd=<password>" to the link and copy
  12. i.e. http://<host>:9704/xmlpserver/viewer.jsp?_xpf=&_xpt=1&_xdo=%2F%7Ebi_opr01%2FDrafts%2Ftest+report+1.xdo&_xmode=&_xt=test+report+1&_xf=analyze&_xana=view&id=chantaiman&passwd=23456789




Grant permission to other report users


  1. Click "catalog" on the top right corner
  2. Select a report > More > Permissions
  3. Click the boxes > click OK
  4. Wait until the changes become effective


2017年10月18日 星期三

[ServiceNow] Creating a Map Page

Step 1: Navigate to "REST Message" > New


Name = Get Lat Long
Endpoint = https://www.geocode.farm/v3/xml/forward

Under section "HTTP Method", click "Default GET".

Under section "HTTP Query Parameters", enter the following information, save

name value order
addr ${addr} 100
country ${country} 200
lang ${lang} 300
count ${count} 400


Step 2: Navigate to "Map Page" > New > Paste the script below


var gr = new GlideRecord('incident');
gr.addEncodedQuery("active=true^caller_id.cityISNOTEMPTY");
gr.query();
while( gr.next() )
{

//  Add copied  REST Message Script BELOW this line

var r = new sn_ws.RESTMessageV2('Get Lat Long', 'Default GET');
r.setStringParameterNoEscape('country', gr.caller_id.country);
r.setStringParameterNoEscape('addr', gr.caller_id.city);
r.setStringParameterNoEscape('count', '1');
r.setStringParameterNoEscape('lang', 'en');

//override authentication profile
//authentication type ='basic'/ 'oauth2'
//r.setAuthentication(authentication type, profile name);

var response = r.execute();
gs.info('c='+gr.caller_id.country+', city='+gr.caller_id.city+', '+response);
var responseBody = response.getBody();
var httpStatus = response.getStatusCode();



//  Add copied REST Message script ABOVE this line


// Extract latitude and longitude values from REST Message response
var xmlDoc = new XMLDocument2();
xmlDoc.parseXML(responseBody);
var myLat= xmlDoc.getNodeText("//latitude");
var myLong= xmlDoc.getNodeText("//longitude");

// Plot each Requested for's location on a google map
var item = map.addItem(gr);
item.latitude = String(myLat);
item.longitude = String(myLong);
item.dialog_title = gr.getDisplayValue();
item.icon = "https://maps.google.com/mapfiles/ms/micons/yellow.png";
item.icon_width = "32";
item.icon_height = "32";
}

2017年9月20日 星期三

[ServiceNow] Delete additional comments or work notes of Incident

First, copy the sys_id of an incident.

Then search the comments in sys_audit and sys_journal_field respectively.

Delete the records carefully.


function confirmDelete(){
   if(confirm('Are you sure you want to permanently delete this history line and all corresponding audit history?\n\nTHIS ACTION CANNOT BE UNDONE!')){
      //Call the UI Action and skip the 'onclick' function
      gsftSubmit(null, g_form.getFormElement(), 'delete_history_line'); //MUST call the 'Action name' set in this UI Action
   }
   else{
      return false;
   }
}

//Code that runs without 'onclick'
//Ensure call to server-side function with no browser errors
if(typeof window == 'undefined')
   deleteHistoryLine();

function deleteHistoryLine(){
   var fieldVal = current["new"];
   var fieldName = current.field;
 
   //Query for and delete the 'sys_audit' record
   var aud = new GlideRecord('sys_audit');
   aud.addQuery('documentkey', current.set.id);
   aud.addQuery('fieldname', fieldName);
   aud.addQuery('newvalue', fieldVal);
   aud.query();
   if(aud.next()){
      aud.deleteRecord();
   }
 
   //Query for and delete the 'sys_journal_field' record (if applicable)
   var je = new GlideRecord('sys_journal_field');
   je.addQuery('element_id', current.set.id);
   je.addQuery('element', fieldName);
   je.addQuery('value', fieldVal);
   je.query();
   if(je.next()){
      je.deleteRecord();
   }
 
   //Set redirect and info message for the parent record
   gs.addInfoMessage(current.label + " entry '" + fieldVal + "' deleted.");
   action.setRedirectURL(current.set.getRefRecord());
 
   //Delete the 'sys_history_line' record
   current.deleteRecord();
}

2017年9月19日 星期二

[ServiceNow] UI Page > Check All Links target blank

<?xml version="1.0" encoding="utf-8" ?>
<j:jelly trim="false" xmlns:j="jelly:core" xmlns:g="glide" xmlns:j2="null" xmlns:g2="null">

<g2:evaluate var="jvar_gr_sc_cat_item" jelly="true" object="true">
var gr = new GlideRecordSecure('sc_cat_item');
gr.addEncodedQuery('descriptionLIKEhref=^active=true');
gr.addJoinQuery('sys_user', 'sys_created_by', 'user_name');
gr.orderByDesc('sys_created_on');
gr.query();
gr;
</g2:evaluate>
<j2:set var="jvar_count" value="1"/>
<head>
<script language="javascript">
function checkBlankLink( id, tid) {

var s = document.getElementById(tid).value;
var finda = s.match(/href=/g);
var findb = s.match(/target="_blank"/g);
var a=0;
var b=0;
if(finda) {
a = finda.length;
}
if(findb) {
b = findb.length;
}
if(a==b)
{
//alert(a+', '+b);
document.getElementById(id).innerHTML='OK';
}

}


</script>
</head>
<body >
<h2>Category Item Target Blank</h2>
<table id="headerTable" border="1" width="100%" cellpadding="10pt">
<tr>
<td>#</td>
<td>OK = All Blank</td>
<td>name</td>
<td>short_description</td>
<td>sys_created_by</td>
<td>sys_created_on</td>
<td>sys_id</td>
</tr>
<j2:while test="$[ jvar_gr_sc_cat_item.next() ]">
<tr>
<td>
$[jvar_count]
<j2:set var="jvar_count" value="$[jvar_count+1]"/>
</td>
<td align="center">
<div id="lbl_$[jvar_gr_sc_cat_item.getValue('sys_id')]" style="color:red"></div>
<textarea id="t_$[jvar_gr_sc_cat_item.getValue('sys_id')]" style="display:none">$[jvar_gr_sc_cat_item.getValue('description')]</textarea>
<script language="javascript">
checkBlankLink("lbl_$[jvar_gr_sc_cat_item.getValue('sys_id')]", "t_$[jvar_gr_sc_cat_item.getValue('sys_id')]");

</script>
</td>
<td>
<a href="sc_cat_item.do?sys_id=$[jvar_gr_sc_cat_item.getValue('sys_id')]" target="_blank">$[jvar_gr_sc_cat_item.getValue('name')]</a>
</td>
<td>
$[jvar_gr_sc_cat_item.getValue('short_description')]
</td>
<!--
<td style="padding:10px;white-space: pre;">
$[jvar_gr_sc_cat_item.getValue('description')]
</td>
-->
<td>
$[jvar_gr_sc_cat_item.getValue('sys_created_by')]
</td>
<td>
$[jvar_gr_sc_cat_item.getValue('sys_created_on')]
</td>
<td>
$[jvar_gr_sc_cat_item.getValue('sys_id')]
</td>

</tr>
</j2:while>
</table>
</body>

</j:jelly>