Episode 26 - Filtering queries from Service Portal in ServiceNow
hi everyone and welcome to the first service now which doctor guy deserves now episode for the decade we're all going for number 26 and hopefully it works smooth I'm just moving into new room I actually broke my mic I don't know why they do stuff in plastic but if you can see here this part should be loose so yeah hopefully it will hold throughout the whole video I've got some small pots over here and some other stuffs up through out the window almost anyway let me back finally up and running again hopefully I will be more often skipping those videos out to you and today we can start is something I don't really know how to put that into one sentence but we'll go into that in a few seconds I call that one filtering depending on it comes from the source portal or the old you are and soon we'll get into it that is let me hope that my course not do this come on there we go for those who doesn't know me my name is going on like beast ain't came in witch doctor being around in stores now community for almost six years now been everything from customer to a partner now working firmly on service now as a developer for service tower themselves so I'm pretty much working on the instances just like you guys works when your company or partners love being in the community trying to help out as much as possible always tooth out of you bullet paths if you like to connect just hit me linking or something it will be I always take this one over there I think I can't see my screen right now so over there you can see the YouTube linking and followed youtube channel of course might be over there as well also for almost published my book which is kind of insane it's almost been a year few bullets points what's in my main focus was to get this stuff that I done wrong the stuff that I found put it in a book give that to you guys so you don't need to need to do it again still valid then of course you know service now we developed very fast I mean this what was written from the grid and now more Latin is coming up so anyway let's not do that market anymore let's hit what are we going to do what I'm not talking about so this is actually one required I had myself there when I was building and that was that depending on if a user looked at the form for a record through the portal or to the back and you I I would like to give them different viewers or different views that meant that we had actually a couple of years and when I go to the phone we get a look through a record it actually doesn't take the total record or portal view it actually goes through the bureau and gives me the same view as I had in the back end and somehow I need to figure out how do I know if the query or this and the question is coming from portal view or from the back end and then i hack attack thoughts on college and they have kind of similar stuff but they would like to have a query business rule to run depending on if the query comes from the portal or from the back end I was going to say something more but I don't remember that is talking about that viewers yeah let's go in and take a look instead so basically so we have our nice little instance here so if we take a look at what we're doing yeah now remember this is actually the first time I have found out functionality that works in a scope tab but not in the global one so for this function to work sadly you have to be in a scope that I haven't found a way to do this in the global scope if you find out please just write in the comments below this YouTube video and we'll get the word out for that one as well but basically it is just a little little thing you need to do is that I created let's go for a query business rooms first and it's basically the same stock for the view rooms so how business rules and in my case I just hit one in the in in the case scope to show you and what you can do loaded oh by the way while we were waiting for this one to load I got to ask none of you where my service now water bottles I have actually bought myself a new one I don't know if you can see it says service now at least it's a really nice one that keep its really little cold for real long time so got one finally back on track so this is it's not harder than this and just to show you how it works I just throw in a nice log so let's go to cases all yours to open a list because we know queer business rules run on list view as well now if I just click to refresh you can see this is what I get back then this is the filter string so I know in this case if I look at the list if you look like this let's take a look to go to my case come on we'll take another one you can see that just doesn't have the underlined list pretty much like you can see in the URL right because that is what you know kind of looking at now the fun part you might rarely seen it in the logs that I showed you because I learned the hard way to actually test it to for our records I don't start recording it and then it doesn't work so if I instead go to the portal and try to look at something and I'll just reload this page and we'll reload and you can see that now suddenly you can see you get a lot of information here so this is where you can actually start doing your differentiation between is it coming from the portal or is it coming from the back end so this is a nice quick way perhaps I don't know that deep or details of that requirement but I can imagine if you probably just want to change a query that is hard coded in a widget a lot about wicket and you don't want to clone that with yet and start in it because we like it to want to keep the NOC grades you can do it through this one as well there of course it all depends on the requirements in total so don't ever do this or don't ever do that just keep it in mind as a solution if we go to view rules and I haven't dun dose but so I said earlier I tested everything myself Patel again here we all wonder I don't think this one this one oh look this is I actually did it earlier when I'm thought about this so basic it's not done as you can see and I've done it in a global scopes it doesn't really work but you can look at the five-string and what I actually did I looked at the string and when you have the view room you can actually see the widget name let me see if I can just give an example that I'm allowed to share so hold on to call yo I'll soon put this up screen and this shouldn't be an secret to edit an honest like that copy and here we go here is an example overlay oh here we go source birth pasting depth line here you can see I'm pretty much doing the same look at you really and here you can see that I'm looking if it either has a couple rolls or if the fine string is this one and this is our own customized widget ICP that form so if any of those one also true return the SP view otherwise we return the coordinator view so that means that if someone that normally has the coordinator view so they look at the back end get the correlate view but if that same person goes to the portal they will actually get the service portal view but then again remember it only works in scope applications I think that was actually it was a quick video hopefully it will help you out in some sort of kinds of requirements you have and if you find a solution for a global scope please comment below and I'll put up a link and shout out to you and get that solution out to people as well so thank you for watching and hopefully we'll see you again soon if I can find where to hit stop
https://www.youtube.com/watch?v=Fy_ZMoLgbTk