Saturday, June 29, 2019

Outbound REST Message of ServiceNow

In ServiceNow, there are two ways to generate REST Message: 
      1. Outbound REST message
      2. Scripting REST Message

In Server Side Script, we can directly use “new sn_ws.RESTMessageV2()” to generate REST Message object without creating “Outbound REST Message” in Studio. But it is not handy to test and debug it. In contrast, “Outbound REST Message” provide an easy way to test it and show it in build-in GUI. It can shorten our development time.

Therefore, in this demonstration, I will focus on “Outbound REST message”.

Preparation

1. Generate a new instance in ServiceNow for this demonstration

2. Go through the pages of Postman Echo to understand how to send REST request to it. We can take advantage of “Postman Echo” to test our REST clients directly, instead of building our own Web Server.

Demonstration

HTTP GET

1. In ServiceNow Studio, click “Create Application File” button on the top, and select “REST Message” and then click “Create”





2. Fill the form’s Name, Description and Endpoint.

Set “Endpoint” to “https://postman-echo.com/get?foo1=${foo1}&foo2=${foo2}”. You can refer to the "Postman Echo" website. Also, select “Authentication type” as “No authentication”



3. Once you save it, the default HTTP methods (Default GET) will be generated automatically. Click it to edit. You can change the name of it if you want.

4. Continue the previous step, click “Auto-generate variables”. Then, you will notice that two new records inserted in “Variable Substitutions”. In order to use Outbound REST Message’s test function, set the “Test value” for those variable substitutions.



5. Click “Test”, then you will see the REST testing result. 



HTTP POST

1. In ServiceNow Studio, click “Create Application File” button on the top, and select “REST Message” and then click “Create”

2. Fill the Name, Description and Endpoint.

Set “Endpoint” to “https://postman-echo.com/post”. You can refer to the "Postman Echo" website. Also, select “Authentication type” as “No authentication”



3. Once you save it, the default HTTP methods (Default GET) will be generated automatically. Click it to edit. Change it to “Post” in HTTP method field.

4. Continue to the previous step, insert “accept” and “content-type” with “application/json” value. Also, fill the Content field as the following picture.



5. Click “Test”, then you will see the REST testing result. 


Wednesday, June 19, 2019

Customize ServiceNow baseline form

We can use “Form Design” to change the form view easily if the information we want to add is existed in its relating table record. However, if those information is not stored in form’s relating table, we could use UI Formatter and UI Macros to customize the form view.

Below is a demonstration steps-by-steps.

1.  First, we need to create a new app for this demonstration

    Open “Studio” -> “Create Application” -> select “Start from scratch”, and enter your application name.


 2. Second, we need to create an “UI Macro” to define the content which will be used by “UI formatter”

    On studio, click “Create Application File”, and select “UI Macro”

 
     


3. Then, we need to create an “UI formatter” which need to point out which “UI Macros” it will use.

On studio, click “Create Application File”, and select “UI formatter”

Note that, the field of “Formatter” should be the name of “UI Macros” you want to use, and end with the “.xml”
    
   
    


4. In the end, we need to add the defined formatter to the form view we want to change.

On studio, click “Create Application File”, and select “Form” -> Create

In this demonstration, I select “Default View” of “Incident [incident]” and add the formatter we created to it.




5.The Application Files structure will be shown as following.


   


6. To test it, open any record from Incident table, you can see the new tab we created through “UI formatter” and “UI Macros”.


Tuesday, May 14, 2019

Notifications of ServiceNow


From the official tutorial of ServiceNow, it provides some hands-on lectures to teach us how to use Notifications. The reference link is click here. I recommend to go through some previous tutorials to gain some background knowledge of Notification before reading this note. 

I divided Notifications into following two pictures. Hopefully, it is helpful to get more insight of how we use it.





Events of ServiceNow


From the official tutorial of ServiceNow, it provides some hands-on lectures to teach us how to use “Events”. The reference link: Click me. I recommend to go through some previous tutorials to gain some background knowledge of Events before reading this note.

The following picture is my note after studying Events of ServiceNow. Hopefully, it can give you a big picture on how it works.

Thursday, May 9, 2019

How to install SSH server to Ubuntu?

Installation

1. Update package list of apt from the repository

$ sudo apt update



2. Install openssh-server. Flag y means that it will assume all the answer will be “yes” from the prompt during installing.

$ sudo apt install -y openssh-server

3. Using the following instruction to check whether the ssh server is running or not

$ sudo systemctl status ssh

4. Also, you can use the following commands to manipulate ssh server

$ sudo systemctl start ssh
$ sudo systemctl stop ssh
$ sudo systemctl restart ssh
$ sudo systemctl disable ssh
$ sudo systemctl enable ssh

Testing

1. Get the IP address from the remote which launched ssh server

$ ifconfig

2. (Windows)Using PuTTY to connect it. Enter the IP address gotten from step 1 and select the SSH as connection type.


3. (Linux) Using the following instruction (remember to replace <Username> and <Server IP address> to yours)

             $ ssh <Username>@<Server IP address>

4. Then you can see the login information.