getReference without callback

SANNAPUREDDYV
Tera Contributor

Auto populate of user details with out callback by using incident table?

3 REPLIES 3

Sandeep Rajput
Tera Patron
Tera Patron

@SANNAPUREDDYV You can use getReference  without callback in client script on the native view. getReference without callback doesn't work on the Service Portal.

Jim Coyne
Kilo Patron

What exactly are you trying to do here?  Very little details in your question.

 

From what I can understand, you want to auto-populate some user details on the Incident form.  And as @Sandeep Rajput points out about the Portal not supporting getReference without a callback, which UIs are you looking to have this work in?

 

So the real question is:  why without a callback?  You can always add dot-walked fields onto the form: no callbacks, not even any code.

Robbie
Kilo Patron
Kilo Patron

Hi @SANNAPUREDDYV,

 

Adding to the great points from @Jim Coyne and @Sandeep Rajput, please note that despite getReference() being available client-side (with or without a callback), it's not best practice.

In short, it's a potential performance overhead as typically during the script and call back only a single value is required, The getReference() will return an entire GlideRecord object.

Best practice here would be to use GlideAjax - See the below link for examples on how to use it.

 

https://docs.servicenow.com/bundle/xanadu-api-reference/page/app-store/dev_portal/API_reference/Glid...

 

To help others (or for me to help you more directly), please mark this response correct by clicking on Accept as Solution and/or Kudos.



Thanks, Robbie