How to Auto populate the 'Due Date' field based on assignment group in problem management

Sravani
Tera Contributor

Hi,

 

I have a requirement " How can we auto populate the Due Date field based on assignment group in problem_task table.

 

example: The assignment group is software then Due date field should auto populate with 5 days from Now and also due date field should be read only. 

Like for all the assignment groups the 'due date' field should auto populate  with 5 days from Now. 

 

Please help me.

 

Thanks in Advance.

 

Regards,

Sravani.P

4 REPLIES 4

MD AQUIB KHAN
Giga Guru

Hi Sravani ,

did you mean for all the assignment group , due date should be auto populated and read only or for assignment group == Software then due date should be auto populated and read only and for others due date should be auto populated

Hi KHAN,

For all the OOB assignment groups the 'Due date' field should auto populate with 5 days from now.

Hi

Please find the scripts below:

// Sorry for the typo: New Value will be assignment group:

 

Client Script:
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
   if (isLoading || newValue === '') {
      return;
   }
	var gr = new GlideAjax('CostCentre');
gr.addParam('sysparm_name', 'getDueDate');
gr.addParam('sysparm_service', newValue);// Newvalue will duedate
gr.getXML(mycallback);

function mycallback(response) {
	var arr1;
    var answer = response.responseXML.documentElement.getAttribute('answer');
	arr1= JSON.parse(answer);
	alert(answer);
	alert(arr1);
	g_form.setValue('due_date' ,arr1);
	g_form.setReadOnly('due_date',true);
}

}
// Script include:
getDueDate: function() {
    var grdatetime;
    var gruser = this.getParameter('sysparm_service');
    var gr = new GlideRecord('sys_user_group');
    gr.addQuery('assignment_group', gruser);
    gr.query();
    if (gr.next()) {
        var gr1 = new GlideDateTime();
          gr1.addDaysLocalTime(5);
	grdatetime=	gr1.getDisplayValue();

    }
   var json = JSON.stringify(grdatetime);
    return json;
},

 

// Newvalue will duedate

Ignore this comment . On change will be on Assignment group.