How do I implement the barcode scanning feature on a UI page?

jimbendoraitis
Kilo Contributor

I am working on a new application that is meant for updating existing asset information. The hardware assets in mind have barcode serial numbers that are used to identify the item, and I want the application to utilize the barcode attribute functionality that is part of the string field for a typical form in order to lookup the asset by serial number.

Basically select the stockroom, scan the asset, and have its state update.

I know how to use the barcode attribute on a form field, and if I can get the input I know how I will do the update on the server script; however, I am cannot figure out how I might get the scanner input function on a mobile UI page.

How might I go about adding in the input field on the HTML UI page, which utilizes this module?

I have looked at jelly syntax extensions, but they don't seem to be the correct route. It seems other posts on the community have mentioned using this kind of a feature, but I haven't seem any explanations as to how.

Thank you in advance!

1 ACCEPTED SOLUTION

srinivas007
ServiceNow Employee
ServiceNow Employee

Hi jimbendoraitis,

there is already an api named cabrillo, which you can use for this purpose. It is very simply to use. There is a method cabrillo.camera.getBarcode() in the api which serves your purpose. You can find information on how to use it here. Feel free to ask any queries regarding this.

 

Thanks,

Srinivas.

View solution in original post

6 REPLIES 6

srinivas007
ServiceNow Employee
ServiceNow Employee

Hi jimbendoraitis,

there is already an api named cabrillo, which you can use for this purpose. It is very simply to use. There is a method cabrillo.camera.getBarcode() in the api which serves your purpose. You can find information on how to use it here. Feel free to ask any queries regarding this.

 

Thanks,

Srinivas.

Hi srinivas007, I'm having a lot of troubles trying to use the cabrillo API, there's some code in the link you provided but I can't make it work, could you please elaborate on how to use that code to be able to read qr codes in the native mobile app, I'm using the london build btw.

 

 

Thank you very much

srinivas007
ServiceNow Employee
ServiceNow Employee

Hi @leonardo.campos,

 

please have a look at this link.

 

This is the good example on how to use cabrillo API. Note that this is not official documentation/ or example.

Hope this solve all your issues.

 

 

Thank you,

Srinivas.

Thanks for your answer Srinivas, I'm trying now to make it work with the code you suggested but it seems like it is not designed for an UI Page since both the client script's code and html code produce sintax errors, I can manage to deal with html errors, but I'm having a hard time trying to make the cabrillo API work, even for a simple isnative(); call, so could you guide me a little more?

 

thank you in advance.