Visibility of Complete button

Saurabh _
Tera Guru

Hi Developers,

                         I want the Complete button to visible on problem form when problem ticket completes 45 days from the time it was resolved. Problem Resolved Date & Time comes under the field name FIX (fix_at).

I have looked the UI Action button configuration but could not find a suitable solution.

Share you thoughts that how to tackle this.

Thanks in advance.

3 REPLIES 3

Guido Bernuetz
Giga Guru
  1. Create a script include with a function which check the dates and returns true/false
  2. Add the script include call in the UI Action condition field with "javascript" prefix
    like this: javascript:(new AssetUtils).canConsume(current)

 

I am not a helpful hunter.
I will always try to give a meaningful and valid answer.

Harshal Aditya
Mega Sage
Mega Sage

Hi @Saurabh _ ,

 

Hope you are doing good

 

Please follow the below steps-

 

1. Create a script include -

 

 

 

var ProblemCompleteButton = Class.create();
ProblemCompleteButton.prototype = {
    initialize: function() {
    },

    canComplete : function () {
		var current_date = new GlideDateTime().getDisplayValue();
		var resolved_at = new GlideDateTime(current.sys_created_on).getDisplayValue();
		var dateDiff =gs.dateDiff(resolved_at,current_date,false);		
		if(dateDiff.split(" ")[0]>40){
return true;
		}
		else {
			return false;
		}
	}
};

 

 

 

Create UI action - With condition

 

Javascript:  new ProblemCompleteButton().canComplete()

 

Please mark this response as correct or helpful if it assisted you with your question.

Regards,
Harshal

 

Hiranmayee Moha
Tera Expert

Hi @Harshal Aditya & @Guido Bernuetz!!

I have similar kind of requirement.

 

The Complete button to visible on Resolved problem form for a specific 'XYZ' team & once clicked, it moves the problem ticket to the Closed state.

 

Kindly share your thoughts.

 

TIA

Hiranmayee