The CreatorCon Call for Content is officially open! Get started here.

Has anybody got the camera api working on service portal?

andro
Kilo Contributor

I'am planning to use the barcode widget for one of my portal page. Has anybody got the "cabrillo.camera.getBarcode()" api working?

9 REPLIES 9

Patrick Fedigan
Giga Guru

Hello Swarup,



I have personally not have used it yet. Here is a thread that may be of help Service Portal - barcode scanning



Cheers,


We're currently working on official Cabrillo documentation. Here is an example of the getBarcode() API. Please note that this is not official documentation. https://gist.github.com/wlisac/6122145d473b998f3748089982fa70fe



Also, Cabrillo JS APIs are only supported when executing in ServiceNow's native mobile apps. You should use cabrillo.isNative(); to determine if Cabrillo is executing in a native context.



Cabrillo is explicitly unavailable from GlideForm client scripts.



Thanks,


Will


willlisac
ServiceNow Employee
ServiceNow Employee

Also — make sure Cabrillo is available in your widget script. Cabrillo JS is easily available in AngularJS as an injectable parameter. For example, you can inject Cabrillo inside of a Service Portal widget's client script.



function(cabrillo) {


      var c = this;



      // Used to determine if Cabrillo is executing in ServiceNow's native mobile apps.


      c.isNative = cabrillo.isNative();


}


andro
Kilo Contributor

Thanks Will. The information really helpful.



My requirement was to get this thing working on ipad device to capture images while submitting an incident and i got it working through the native servicenow app (on service portal / ticket conversation widget). The attachment widget detects device and gives option to open camera and click.



Regards,  


Swarup Roy