- 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 09:29 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-15-2015 10:55 AM
Hi Pradeep,
I had gone through this before and tried the below code, mine is an onChange() script , and I have added the below code in Script includes.
var dur = new DurationCalculator();
dur =gr.duration.dateNumericValue() + gr.duration.dateNumericValue();
gr.duration.setDateNumericValue(dur);
But it is returning NaN
Since I am passing the parameter values , I am not sure whether to use gr.duration
So I tried
dur = param1.dateNumericValue() + param2.dateNumericValue();
return dur;
this is also returning NaN
Thanks
Uma

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-15-2015 11:39 AM
Hi Uma,
Try this on business rule. If not use client script + GlideAjax.
Please let me know if you have any questions.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-15-2015 08:16 PM
Hi Pradeep,
As mentioned in my above reply I have used GlideAjax in client script & wrote the above code in script includes but it is returning NaN.
Thanks
Uma