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

No I have not. Stumped on this, and put it on the back burner. Thinking about perhaps copying that date out to another field I can reference somehow, but have not proceeded yet. I will update if I find a way to change the behavior of dates in the widget/portal.

Steve Wiseman
Tera Guru

Thanks for coming back to me Jeff. Yes am stumped as well! If I get anywhere with it I will also post an update on this thread.

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!

Brilliant, that has worked for me! Thank you Allen!

Hope it fixes it for you as well Jeff.

Steve

Glad I could help.

And original poster, once you get to try this, I'm sure it'll work. Please mark my reply above as both Helpful and Correct. This helps show others the answer quickly and marks your issue as resolved.

Thanks!


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