show record values in HTML field in backend, NOT SP NOT widgets

woodyfairley
Tera Guru

Hello Experts, I wish you all well.

I am using HTML fields in my form to allow users to add their content to the backend form similar to the "Build Terms and Conditions" UI Action and how it allows users to create records containing language blocks (terms and conditions for a contract) into the form itself in the backend. In the PDI the UI Action is named: "build_terms" on the table: "ast_contract".

They want to incorporate field values directly into their HTML content, but I do not know how to enable this directly within the HTML field, similar to a UI Macro.

I am doing this for them in the UI Macro language by using "$[current.field_name]" to display the field's value, but they want to replicate this same behavior in their HTML field content blocks so that a record's field value is inserted into the text when the setValue happens. I will continue my research and add a solution when I find it, but hoping one of you experts can show us the right way to do this. My initial psuedo-code is as follows:

The table I am using for the Service Descriptions (HTML-formatted user input):

0. USER IS ENTERING INFORMATION INTO A HTML FIELD AND WANTS TO REFER TO A FIELD VALUE IN THE AGREEMENT RECORD

1. var hotAgreement = new GlideRecord(agreement_table);

2. hotAgreement.get(g_form.getValue(agreement_reference_field_in_service_record);

3. USE HOTAGREEMENT FOR VALUES COLLECTION AND ASSIGNMENT IN HTML FIELD

4.

The table containing the contract/agreements (target for service descriptions)

1. USERS CLICK THE BUILD AGREEMENT TERMS CUSTOM UI ACTION, THIS PART WORKS

2. HTML CONTENT CONTAINS VALUES FROM THE AGREEMENT RECORD FIELDS, WANT TO DO THIS

Kind Regards,

Woody

15 REPLIES 15

Good question, and the business case is that the users are unable to dynamically edit the content in a UI Page or UI Macro, which I already use for some of the static content, along with the fields. The business case is for users in the role of service provider can edit content in the form directly: using translated html fields on the form enable this functionality. They also enter the field values such as cost and period of performance, which I incorporate into the UI Macros on the form. This community request is to learn how to incorporate the field values into their html content. The business process is a contract, the roles are service providers and customers.

The MVP I released last year was built with UI Macros and fields, which correspond verbatim with a pdf used for signatures. This year I want to enable user-entered content.

I don't think I fully understand what the reason and the ask is but are you trying to do something like below gif. Hot Agreement is a Translated HTML field and is read only so that it is only updated by the UI Action:

poc_html.gif

Yes, this is very similar to what I've currently created, but I would like to include existing field values into the translated html field, similar to the behavior seen in UI Macros with the syntax: $[current.fieldname] which then inserts the value contained in the fieldname field. I just don't (yet) know the syntax for doing this in the TinyMCE html editor.

I am grateful for your efforts to help, thank you.

Ah I see. You won't be able to make them like a current.fieldname because it's just data within the translated html field. Anything in the TinyMCE is kept as data inside that field.

The other thing is that out-of-box there are certain aspects of html that get stripped out such as if you want to "save" a value with an input field inside a translated html field. In the screenshot I posted, the end result is not an input field. And it's because by default the "value" attribute is stripped from that field once saved.
This is on purpose because that HTML field is not meant to be a data store.

That said you can build this to have the appearance of what you described for example the variable editor that holds variable data from a request item. That data is being held on a separate table.

 

EDIT:

All above is still true however, I think I know how to do it. I need to do my actual work first and then I'll get back to this.

Thank you for this dialog Chris! Just to clarify (before you invest time into a solution), I am not trying to store data in the html fields, only reference the data in the record's existing fields; this enables the users to create nicely formatted text (contract clauses) that incorporate the field values, such as business name, address, and other standardized contract data that is unique to the interesting record.