Use getElementById in catalog client script

hichamlasfar
Kilo Contributor

Hello,

I want to retreive the widget data (which is an HTML table in my case) on a client catalog script to store a dynamic table data into a producer result, nearly the same problem was discussed in this post: Widget and Record Producer .

In order to do that, I want to use: document.getElementById("tableId"); in a catalog client script and do other javascript process, the problem is that I think it's not possible to manipulate the DOM in catalog client script (I'm in Helsinki). is there any solution to this problem (use the DOM or other alternative) in the post shown below they are speaking about: $scope.page.field.value = VALUE but I don't how can I use it?

Thanks in advance

8 REPLIES 8

Geoffrey2
ServiceNow Employee
ServiceNow Employee

I don't know anything about the Service Portal, sorry.   But there are 2 other methods you can try:


gel('id')


g_form.getControl('name')


"getControl" doesn't work in Service Portal.  


scottl
Kilo Sage

I'd suggest building the table using a widget (through angular), this way you can access to the data directly through the model reference.



See my response in the linked topic, hopefully that may give some more insight...
Re: Widget and Record Producer



Also, you can reference elements within the dom through angular. See my response here also..


Re: service portal, widget, client script, link, event triggers


salu
Mega Guru

Hello Hicham,


Do you get any solution for this?


I also trying to get the same,I need to get the sys_id of a variable via catalog client script.



Thanks


Saranya