g_form - setValue on Compose elements

SzymonW
Tera Contributor

Let's say that I want to add some footer when user edits Compose -> Comments

Screenshot 2023-09-28 at 09.15.11.png

g_form.setValue('comments', g_form.getValue('comments') + ' ' + yourFooter);

 

and it's working (thou it's just silly example, cause I know, it has a bug if we call it like that onChange(), ignore it) in the incident edit view. But it's not working in the workspace 'compose' tab.

Thou I see in logs, everything is fine. Just g_form.setValue does not make any effect on the input.

 

If I change comments to description - it's gonna work as desired on both views, but it's not working on Compose.

 

 

 

How to edit this field via script when user edits it?

 

Ah I was on Utah, but upgraded to Vancouver - still same problem.

1 ACCEPTED SOLUTION

AnveshKumar M
Tera Sage
Tera Sage

Hi @SzymonW ,

This is expected behavior, please check the following KB from ServiceNow for a work around on Journal Fields.

 

https://support.servicenow.com/kb?id=kb_article_view&sysparm_article=KB1117349

 

Please mark my answer helpful and accept as solution if it helped you 👍✔️

Thanks,
Anvesh

View solution in original post

5 REPLIES 5

AnveshKumar M
Tera Sage
Tera Sage

Hi @SzymonW ,

This is expected behavior, please check the following KB from ServiceNow for a work around on Journal Fields.

 

https://support.servicenow.com/kb?id=kb_article_view&sysparm_article=KB1117349

 

Please mark my answer helpful and accept as solution if it helped you 👍✔️

Thanks,
Anvesh

Hi @AnveshKumar M 

thanks for quick reply!

So, this is required to set by the user. If my app would be published on Store, I would need to add additional instructions how to achieve that, is that right?

Do you know if I can automate it somehow as app developer for users?

@SzymonW You can instruct them but the customer might not want be interested in doing that.

 

Have you tried using Business Rules, instead of client script?

Thanks,
Anvesh

@AnveshKumar M Business Rules are on server-side right? It's essential for me to edit this, live, when user is typing text, so they see what the application is changing.

Anyway, thanks!