Portal Widget - Ticket Fields - Due Date Display Issue

jlaps
Kilo Sage

Good afternoon community,

I am attempting to add a displayed field to the TICKET FIELDS widget on the portal. I have the field added (DUE_DATE), by editing the server script side to include it, but when it is displayed on the portal, it is not displaying the due date, but for some reason showing JUST NOW (actual data in field is "1/10/2020 08:11:58 AM")-

find_real_file.png

I am little stumped since the date created is correct... do I need to have it display the display value instead somehow, or is there something else I can do?

Thanks everyone!

Jeff

1 ACCEPTED SOLUTION

Allen Andreas
Administrator
Administrator

Hey all, I think I can assist with this. 

So you have this section (around line 16 or so):

var fields = $sp.getFields(gr, 'number,state,priority,sys_created_on');
	if (gr.getValue("sys_mod_count") > 0)
		fields.push($sp.getField(gr, 'sys_updated_on'));

Now right below this, add this in (and just shift everything else that was already here down):

for(var i = 0; i < fields.length; i++) { 
		if(fields[i].label == "Due date") 
			fields[i].type = "string"; 
	}

And that should be all you need.

So final could look somewhat like this:

var fields = $sp.getFields(gr, 'number,u_item_name,priority,category,state,subcategory,stage,u_reject_code,due_date,u_reject_reason,sys_created_on');
	if (gr.getValue("sys_mod_count") > 0)
		fields.push($sp.getField(gr, 'sys_updated_on'));
	
	for(var i = 0; i < fields.length; i++) { 
		if(fields[i].label == "Due date") 
			fields[i].type = "string"; 
	}

Please mark reply as Helpful/Correct, if applicable. Thanks!


Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!

View solution in original post

10 REPLIES 10

Jaspal Singh
Mega Patron
Mega Patron

Hi, 

 

Can you kindly help with the script tweaked for the widget.

 

Thanks,

Jaspal Singh

 

Hit Helpful or Correct on the impact of response.

On the TICKET FIELDS widget, I edited the fields line near the top and just added due_date into it like I did the other fields I wanted in there-

---

(function(){
data.pickupMsg = gs.getMessage(options.pickup_msg);
var gr = $sp.getRecord();
if (gr == null)
return;

data.canRead = gr.canRead();
if (!data.canRead)
return;

var agent = "";
var a = $sp.getField(gr, 'assigned_to');
if (a != null)
agent = a.display_value;

var fields = $sp.getFields(gr, 'number,state,incident_state,stage,priority,sys_created_on,due_date,cat_item');

---

More below that, but that last line is what I added to the OOB widget.

This is on the SERVER section by the way.

Steve Wiseman
Tera Guru

Hi Jeff,

I have got the same issue. Did you manage to get any further with this?

Thanks

Steve