onChange Client Script for changing dot walk field

John91
Tera Contributor

Hi,


I created new custom table and added two reference fields.
In Incident view, these fields are added as dot walk.

 

Then I created onChange client script for the custom table but this didn't work for Incident view.

 

Secondly, I tried to create onChange client script for Incident table, but of course, I couldn't set dot walk field.

John91_3-1689754304054.png


Is there any way to set dot walk fields to onChange target field (Field name)?

If you need more detail for answer, please tell me.
Thanks!

8 REPLIES 8

Dan O Connor
ServiceNow Employee
ServiceNow Employee

I see. And when do you want the value to populate into table B? When the user and group is set in table A? 

 

I am pretty sure this is possible. I just don't fully understand the context so not sure what will be the best solution. 

 

Like as an example you could just use Flow Designer(which I try use where possible to replace scripting).

 

So when let's say the fields in table A are populated/changed, lookup relevant records in table B. Then update table B with the values from Table A. 

 

How are the records related between table A and B? 

@Dan O Connor , thank you for your quick reply.

The best timing of population of the group is when the user is set in table A before submitting (like onChange client script).

The relation is just that table A (custom table) is referenced in the table B (Incident table).
... table B has the reference field of table A, and when table A is created table B is automatically created by business rule with filling the reference field.

As you said, flow designer may be one of the good way to fulfill my request.
Also, I thought it will be good to use reference qualifier but it needs for us to choose,
Or using business rule may be good, but both of the timings are slightly diffrent from my best request (the different may be allowable).

How do you think about my idea, or do you have the best way?

Regards,

Dan O Connor
ServiceNow Employee
ServiceNow Employee

OK so if the field in Table B needs to update, when the field in Table A is populated (before submitting) then you are on the right track with the OnChange script, as Flow Designer needs the record to be updated before it can trigger. 

 

 

Mate Levai
Tera Contributor

You can actually do that!

  1. Create an onChange Client script with any other field
  2. Open the Client script list view, filter on that client script
  3. Add column “Field name”
  4. Replace the Field name value with the dot walk field like: “table.field_name”

Note: dot walked field needs to be on the form