Pass data from widget to Catalog Item Form Variables

jakehford
Kilo Contributor

We've created a ticket submitter landing page, and we have a dropdown of incident categories for the user to choose from. When they choose an incident category, it should take them to our Catalog Item Form(Incident Record producer) for submitting an incident ticket, and automatically populate the category field of what they just selected. I'm very new to the NOW platform, but I feel like this is doable. How can we pass data from this widget to the catalog item form? It would be somewhat similar to the old PHP session variables I'd imagine. I know you can pass data from widget to widget, but from widget to catalog item variable fields?

 

UPDATE: I realize that I have to use the Angular $rootScope method with $broadcast. However, not sure if I can write a client script function that can accept the $rootscope as a parameter (Seems like this is only done between widgets).

 

I attached a screenshot of what the form looks like.

find_real_file.png

 

 

2 REPLIES 2

matthewmaxwell
Kilo Guru

Hi jakehford,

Is there any particular reason a query string would not work here? Attaching "?incidentType=databases", for example, to the end of the URL and then using JavaScript to parse that value off of the location should work. (or "&incidentType=databases" if the URL already has a query string on it)

That said, it's generally advised against using $rootScope. It's dangerous in the same way that the global namespace is dangerous in JavaScript. If for some reason the query string route did not work for you, I would strongly advise creating a factory to store data instead of using $rootScope.

Matthew,

I wasn't sure if URL Parameters were possible from portal or how exactly they worked, but I like that solution a lot more. Thanks for the information on $rootScope as well.