- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-15-2015 09:28 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-16-2015 12:28 AM
Hi Uma,
After spending some good amount of time on your req, Here is the working solution.
Create a client script :
var dur1 = g_form.getValue('u_dur1');
var dur2 = g_form.getValue('u_dur2');
var ga = new GlideAjax('HelloWorld');
ga.addParam('sysparm_name','helloWorld');
ga.addParam('sysparm_user_dur1', dur1);
ga.addParam('sysparm_user_dur2', dur2);
ga.getXML(HelloWorldParse);
function HelloWorldParse(response) {
var answer = response.responseXML.documentElement.getAttribute("answer");
alert(answer);
g_form.setValue('u_dur3',answer);
}
Script Include :
Name : HelloWorld
Client Callable : True
var HelloWorld = Class.create();
HelloWorld.prototype = Object.extendsObject(AbstractAjaxProcessor, {
helloWorld: function() {
var result = 'true';
var dur1 = this.getParameter('sysparm_user_dur1');
var dur2 = this.getParameter('sysparm_user_dur2');
var x = new GlideDuration(dur1).getNumericValue();
var y = new GlideDuration(dur2).getNumericValue();
var total = x + y;
var tota11 = new GlideDuration();
tota11.setNumericValue(total);
return tota11.getDurationValue();
},
_privateFunction: function() { // this function is not client callable
}
});
Please change the column name and naming conventions after round of testing.
I have tested it and it is working fine at my end. Please let me know the outcome.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-15-2015 10:09 PM
Hi Uma,
u have to just store addition in one variable and give that value to that third total duration field. see below lines.
var total = current.u_dur1.dateNumericValue() + current.u_dur2.dateNumericValue();
current.u_total_dur.setDateNumericValue(total);
u can similarly do that with client script + script include combo. show me script include n client script if u want further help.
please mark it if it was Helpful.
thanks,
Rushit Patel
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-16-2015 12:17 AM
aa

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-16-2015 12:25 AM
I had answered this some time back. Check if that helps
Re: How do I "add" a duration value onto an already existing duration value?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-16-2015 01:11 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-17-2018 04:03 AM
Hi Pradeep, any chance you could please take a look at a similar query on my recent post here:
https://community.servicenow.com/community?id=community_question&sys_id=6aa6a486db0a57c058dcf4621f9619d5
I would be very grateful. Thanks.