Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Work in client script with getReference dotwalking

gabriel_sk
Tera Contributor

Hello team,

First of all sorry for the newby question. I will try to explain what I am trying to achieve:

I have created a new table where to perform a ticket assessment. In the form I use, I enter the ticket number and then all info regarding the specific ticket appears (only some fileds). So far all good... but I have 2 specific issues:

1 I would like the ticket that have been already assessed not appearing anymore in the reference field I use to browse to select an incident. I have thought of this solution:
I added a field to the incident entry called Incident reviewed, and placed it in the ticket review form... so when this box is tick, the specific incident will not appear anymore (via filtering the reference field).

I would like to use a client script to make this automatic... ex. when the Incident number get populated the incident reviewed tick box should get tick.

In client script I use something link this:

var test = g_form.getReference('u_inc_number').u_reviewed;

g_form.setValue(test, true);

Nothing happen   is there a way to get it working? I tried also using

document.getElementById('u_tickets_review.u_inc_number.u_reviewed').checked = true;

no luck!

Notice: the reference field on the table is u_inc_number which is pointing to the incident table. Via u_inc_number, I added to the form via dotwalking the other incident table fields such as u_reviewed.


2 I have also another element giving me issues, in this case the Additional Comments (a journal field in the incident table). Instead of displaying just its content it add also the time stamp and the creator:

"06/14/17 09:43:54 - System Administrator (Additional comments)"

This could be fine but when I save the form, the system recognize it as a new comment in the incident and add it

I thought of copying the content of additional comment in a newly created column of the ticket review table... but so far I was unable to get the content copied still using getReference...

Nothing appear.

Do you know what I am doing wrong?

or is there is a way not to avoid the incident table to be updated when i save the incident review for that specific additional comment field?

Thank you so much for all your support:)

5 REPLIES 5

Glad you got it worked out. You've followed the path of least resistance and greatest flexibility - use server side code when ever possible.