Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-14-2023 02:09 AM
Hi all,
i have a requirement to populate the start/end date from the change to all new(manually) created CTASKs.
i created a client script (for testing i only used start date first) for this but i think im missing something..
function onLoad() {
//Type appropriate comment here, and begin script below
if (g_form.getValue('planned_start_date') == '') {
g_form.setValue('planned_start_date', 'change_request.start_date');
}
}
can anyone point me in the right direction ?
Solved! Go to Solution.
1 ACCEPTED SOLUTION
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-14-2023 08:00 AM
Hi @jean-pauldehaas ,
Sure! See below for the Script Include:
var ChangeTaskUtils = Class.create();
ChangeTaskUtils.prototype = Object.extendsObject(AbstractAjaxProcessor, {
getDates: function() {
var parentChange = this.getParameter('sysparm_parent_change');
var gr = new GlideRecord('change_request');
gr.get(parentChange);
var pstart = new GlideDateTime();
var pend = new GlideDateTime();
pstart.setValue(gr.getValue('start_date'));
pend.setValue(gr.getValue('end_date'));
var results = {
"planned_start": gr.start_date.getDisplayValue(),
"planned_end": gr.end_date.getDisplayValue()
};
//gs.log("Results: " + JSON.stringify(results));
return JSON.stringify(results);
},
getAssignmentGroup: function() {
var parentChange = this.getParameter('sysparm_parent_change');
var tasktype = this.getParameter('sysparm_task_type');
var gr = new GlideRecord('change_request');
gr.get(parentChange);
if (gr.type == 'standard','normal' && tasktype == 'customer_coordination') {
var assignmentgroup = gr.getValue('assignment_group');
return assignmentgroup;
}
},
type: 'ChangeTaskUtils'
});
20 REPLIES 20
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-15-2023 02:59 AM
Good to see, finally you got the solution.
*************************************************************************************************************
If my response proves useful, please indicate its helpfulness by selecting " Accept as Solution" and " Helpful." This action benefits both the community and me.
Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/atul_grover_lng [ Connect for 1-1 Session]
****************************************************************************************************************
If my response proves useful, please indicate its helpfulness by selecting " Accept as Solution" and " Helpful." This action benefits both the community and me.
Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/atul_grover_lng [ Connect for 1-1 Session]
****************************************************************************************************************