Form widget clears values after Save

jcmings
Mega Sage

(This was posted in the Developer forum as well, but thought I may have luck here.)

 

I have duplicated the OOTB form widget and am using it to display case data on a custom page. I am using a custom table that is a child of HR Case and an HR Service built on that custom table. Whenever I save the form (even using OOTB UI actions), the widget "refreshes" and all of the values in string/checkbox fields get cleared. However, the updates do actually push to the server -- if I refresh the page or view the case in the back-end, the updates are there.

 

I believe this has something to do with my table specifically... When I test this using the OOTB form widget, table=sn_hr_core_case and another (HR Service) record's sys_id, the widget "refreshes" but the values stay on the form. If I change only the sys_id to that of my custom HR Service, the values get cleared. So any time my HR Service or table is inputted, the values clear, even on the OOTB form widget.

 

Do I need to add a record watch? I am confused because this appears to work for other HR Services. It may also be worth noting that I am unable to post work notes/comments to the case from the back-end currently. Not sure if this is related somehow.

1 ACCEPTED SOLUTION

Hey @James Chun, I actually just was able to figure out the issue... there is a function spUtil.simulateFakeFormSubmitForAutoComplete('widget-form', $scope.data.f._fields) that gets called within the function constructResponseHandler() in the client script of the form widget (ID: widget-form). I can't find any documentation on this specific function and have reached out to HIWAVE for more info... but commenting out this code seems to fix the inputs disappearing.

 

spUtil.simulateFakeFormSubmitForAutoComplete() function, which causes inputted fields to disappearspUtil.simulateFakeFormSubmitForAutoComplete() function, which causes inputted fields to disappear

 

I figured this out by looking for when/how the widget data gets loaded. Sure enough, when the UI action completes (per the screenshot below) the loadForm() function gets called and then this constructRespondHandler() function gets called. At the end, this fakeSubmit thing happens.

 

widget-form client script (loadForm() function)widget-form client script (loadForm() function)

 

I'll update this thread when I hear back from HIWAVE. Until then... thanks for your help debugging! Hope this helps someone in the future.

View solution in original post

10 REPLIES 10

James Chun
Kilo Patron

Hi @jcmings,

 

That's very odd, but since the only variable here is your COE, I am guessing it's the source of the issue.

Have you tried turning on the audit functionality of your COE? That may fix the work note/comment issue and the widget issue as well.

 

Thanks

@James Chun  -- thanks for responding. You did solve my comment/work note issue; it turns out I did not have Audit set to true. For those who come in the future, if you run into this issue, head to System Definition > Dictionary and filter to Type=Collection and pull in the Audit field. Make sure it's set to true for your table!

 

I was hoping this would somehow magically fix the widget issue, but it hasn't. I'll keep looking into it and will update on this thread when I figure it out.

Good to hear one issue is solved! Can you please provide a screenshot of where the form widget is 'cleared' after saving? Does the URL change as well?

Sure thing... you'll notice that Choice dropdowns (the first question, with a error message applied) do not clear. The URL does not change; the page itself does not load.

 

It may be worth nothing that the "Back" and "Next" UI actions control which sections display on the form widget via a UI Policy (this essentially looks at a status field and shows/hides sections depending on the status). If I leave the page ("Next") and return ("Back"), the values stay cleared. If I refresh the page, they re-appear. Even if I use the "Save / Exit" UI action, the widget will "refresh" and the values clear. All three of these UI actions do a current.update(). Regardless of the UI policies, using the Save feature on the OOTB form widget with OOTB actions clears values for this COE/HR Service.

 

Before Save

Form before saveForm before save

 

After Save

Form after saveForm after save

(Not caught in the screenshot is the "Record Updated" message that displays as both as infoMessage and along the footer (next to UI actions). Also not caught is the infoMessage associated with the Next/Back actions.)