how to autopopulate a field from another table

cpinedatx94
Tera Expert

I have 3 fields that need to be autopopulated. But thee values come from fields on another table/form

 

how would i go about writing a client script for this?

2 REPLIES 2

Sujatha V M
Kilo Patron
Kilo Patron

@cpinedatx94 

 

If you want a function a Script Include to return multiple values you should return an object instead of one value. This object should be converted to a JSON string. This way you can retrieve it in your Client Script. Please see below my example to retrieve multiple user information from a single function. You can then rewrite your code so that it would use the same approach.

 

https://www.servicenow.com/community/developer-forum/how-to-retrieve-multiple-values-from-a-script-i...

 

https://www.servicenow.com/community/developer-forum/need-to-return-multiple-values-from-script-incl...

 

Please share more details if you need help on your requirement. 

 

Please mark this as helpful and accept it as a solution if this resolves your query.

Thanks,

Sujatha V.M.

Please mark this as helpful and accept it as a solution if this resolves your query.
Sujatha V.M.

swathisarang98
Giga Sage
Giga Sage

Hi @cpinedatx94 ,

 

You can write a Display business rule on your table(table A) and glide record to Custom table(table B) field fetch the values and update the table A with current.<table A field name> = <glideRecordOBject>.<table B name>

 

Please let me know if you need help with scripting part,

 

Please mark this comment as Correct Answer/Helpful if it helped you.

Regards,

Swathi Sarang