Single Responsibility Principle

I am reading great book at the moment titled Clean Architecture A Craftsman’s Guide to Software Structure and Design and I ask myself, is there anything I can apply from this book… i think the answer is yes! As ServiceNow professionals, can we learn anything from Single Responsibility Principle for example? I think yes again.

But first, what is Single Responsibility Principle?

Continue reading “Single Responsibility Principle”

AJAX again

Hello Friends

Today I am writing again about AJAX – I actually wrote back in 2014 a blog post about this very same topic but it seems that I really like this topic so I thought to write about it again.

before getting into the weeds, quick recap of two concepts

Synchronous is real-time communication method where each party receives messages instantly and requestor needs to wait for the request to be complete.

Asynchronous  is a communication method of exchanging messages between parties in which each party receives and processes messages whenever it’s possible to do so, rather than doing so immediately upon receipt. requestor immediately continues with its work without caring for the immediate result.

When to use GlideAjax ?

Continue reading “AJAX again”

Escalation Rules

When you are in almost any HR project, you got asked this question – How i can escalate HR cases? if you are new to human resource service delivery, you would think about this requirement in terms of SLA, but in HRSD, escalation doesn’t mean the same thing!

In HRSD, escalation process is to assign HR cases to HR agents with the appropriate skills. Continue reading “Escalation Rules”

Translation – Messages

If your system is going to be used in multiple languages you might need to think twice before you hard code any message for your backend users or Service portal users.Hard coded messages don’t get translated automatically when a user changes languages, in this case what you need to do is to add the message that you want to display on sys_ui_message table which contains your original message as well as the translations for informational messages, confirmation messages, error messages, and other types of system messages. Continue reading “Translation – Messages”

ServiceNow® Knowledge Management

I was reading a book about effective ITSM, there was part in the book talking about how many knowledge management initiatives fail to address the people, cultural and procedural elements also how some organisations think about knowledge management as FAQs.

as we all know that knowledge management is much more than FAQs! it is the systematic identification, capture, dissemination and use of information for the benefits of your organisation.

ServiceNow actually makes it easy to implement effective knowledge management that enables organization to addresses the main objectives of knowledge management.

so what are the objectives of knowledge management? Continue reading “ServiceNow® Knowledge Management”

How to sum two or more currency values?

function onSubmit() {

var Price1 =parseDecimal(g_form.getValue(‘u_price’)); // Call parseDecimal function
var Price2 =parseDecimal(g_form.getValue(‘u_price_2’));// Call parseDecimal function
var Total = Price1 + Price2 ;
g_form.setValue(‘u_total’,Total);//populate total field by the sum of Price1 and Price2

}

function parseDecimal(d) {

// Remove currency and any potential any undesirable character
d=d.replace(/[a-zA-Z\!\@\#\$\%\^\&\*\(\)\_\+\-\=\{\}\|\[\]\\\:\”\;’\\?\,\/\~\`]/g,””);

// Loop through the currency and replace the comma
while (d.indexOf(“,”) != d.lastIndexOf(“,”))
d=d.replace(/\./,””);

return parseFloat(d);

}

Scripted Web Service

I am so excited to talk about Scripted web service in ServiceNow . it is very powerful tool that allow you to receive SOAP messages and manipulate it without having a real table/entity in ServiceNow.You can read about it here
http://wiki.servicenow.com/index.php?title=Scripted_Web_Services. the thing is why scripted web service is very important ? Well , from my point of view the importance of scripted web service being that it is not having access a direct access to your data layer this number 1, the second thing that its allow you to fetch the parameters from “Input parameter” the you can easily manipulate these parameters. Continue reading “Scripted Web Service”

Convert date to UNIX time stamp

lets start off with getting to know what is Unix time stamp.
UNIX time stamp is a way to track time in seconds, the tracking start from 01-01-1970.
in ServiceNow,sometimes we are in need for this kind of format especially in integration tasks . the function below would make it easy to convert glide date to UNIX time stamp 🙂
function ConvertToUnix(passdate){
// Import Java Date Class
var Date = Packages.java.util.Date;
//get glide date object
var gdt =passdate.getGlideObject();
// create instance from date object . pass date as milliseconds . getNumericValue() would do the job
var date = new Date(gdt.getNumericValue());
// getTime converts date to unix time stamp
var diff = date.getTime();
// return unix time stamp
return diff;
}

GlideDate to ISO 8601

as i start this article, i have a confusion to say . i really hate working with date:).however,if you are dealing a lot with custom integration you probably notice that working with date in ServiceNow is more a complex.
in some cases, like for example sending date in SOAP Message, you need to follow ISO-8601 standard . The example below,shows how to convert GlideDate to  ISO 8601 with two different format

2014-09-02T11:28:56+00:00
2014-09-02T11:28:56Z
Continue reading “GlideDate to ISO 8601”