Highlighted
mubangud Absent Member.
Absent Member.
9641 views

Reports not propertly displaying field selection for single select field when using javascript


I introduced a new javascript that would read information from a single relational field (PRIORITY) and based on that field value would setfieldvalue for a single selection (PRIORITY SUMMARY). The javascript was attached to both default state and transition forms. The script correctly set the values for all old and new records but when I ran my list report the priority summary field column keeps displaying the "(None)" for all old records. For all new submitted records the items display correctly in the report.

The only way I am able to get the report to display the correct value was to make sure that the PRIORITY SUMMARY field was editable on the form and perform an update without having to modify the value in that field. For some reason after I executed the "Update" and the record would properly display on the report. Now this wouldn't be a problem if you have a few old records but if the numbers are in the thousands this would take quit a long time. The current workaround is to perform mass update but I am trying to see if there is an easier way to fix this problem without having to update all current records in the project.

javascript used:

===================================================

AddLoadCallback (PrioritySummary);

function PrioritySummary()

{

var priorityvalue = GetFieldValue("PRIORITY");

var prioritysum = GetFieldValue("PRIORITY_SUMMARY");

if (priorityvalue == "(None)")

{

SetFieldValue("PRIORITY_SUMMARY", "None");

}

else if (priorityvalue == "C1")

{

SetFieldValue("PRIORITY_SUMMARY", "Critical");

}

else if (priorityvalue == "H1"||priorityvalue == "H2"||priorityvalue == "H3"||priorityvalue == "H4"||priorityvalue == "H5"||priorityvalue == "H6"||priorityvalue == "H7")

{

SetFieldValue("PRIORITY_SUMMARY", "High");

}

else if (priorityvalue == "M1"||priorityvalue == "M2"||priorityvalue == "M3"||priorityvalue == "M4"||priorityvalue == "M5"||priorityvalue == "M6"||priorityvalue == "M7")

{

SetFieldValue("PRIORITY_SUMMARY", "Medium");

}

else if (priorityvalue == "L1"||priorityvalue == "L2"||priorityvalue == "L3"||priorityvalue == "L4")

{

SetFieldValue("PRIORITY_SUMMARY", "Low");

}

}

function PageLoad()

AddChangeCallback(PrioritySummary);

AddChangeCallback("PRIORITY", PrioritySummary);

AddChangeCallback("PRIORITY_SUMMARY", PrioritySummary);

===================================================
0 Likes
1 Reply
jeff_malin Absent Member.
Absent Member.

Re: Reports not propertly displaying field selection for single select field when using javascript


Javascripts run locally on the client when you view or update an item, they wouldn't effect old records if you don't open them individually. You need to run a couple of mass-updates or do a back-end SQL update if you're familiar with the DB Schema
0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.