Skip to main content
Nintex Community Menu Bar

Targeting a Panel via URL (or: How to Idiot-Proof Notifications)

  • February 3, 2017
  • 12 replies
  • 63 views

rhia
Forum|alt.badge.img+15
  • Novice
  • 760 replies

Panels.


Panels never change.

 

But what DOES change is who can see them, and when. This is what initiated my most recent client request: "Make sure that when the Manager goes into the form, that they can only see the Manager panel, and the Software panel - and not the other two." 

 

"Simple!" I replied. Our panels are JavaScript controlled beauties; a sight to behold. Easy to hide using Nintex rules.

 

I spoke too soon.

 

"Also," they began, "Ensure that the Manager is taken directly to the Manager panel when they open their notification link."

 

My endless Googling and Nintexoogling of "target panel" was fruitless; if nothing else, I hope this blog will cement the words "target panel" forever in the search terms so that I can help future Rhias of the world come to this solution:

 

Step 1) Determine your code word. For me, it was "managers" and "software". We will focus on "managers" for this example.

 

Step 2) Ye olde JavaScript. Plop this into your Custom JavaScript settings:

 

NWF$( document ).ready(function() {
  if(location.search.indexOf("manager") > -1) {
  showPanelManager();
  }
});‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍

 

Explanation: This JS looks at the URL, and checks to see if the word "manager" is in it. If it is, it runs the JS function "showPanelManager()" which is what controls our Manager panel.

 

Step 3) In your workflow, wherever the URL is going to be doled out to a manager, append either:

               a) If after .aspx, add a ?manager (.aspx?manager)

               b) If after other data (such as ID=360), add an &manager (ID=360&manager)

 

And, simple as that, you can now send your user directly to whichever panel is appropriate to them.

 

AND ... even if you don't need this ... think of all the cool things you could do by using a URL in this way! Append a word, and magically run ANY function! NEAT.

 

Any questions? Comments? Let me know! I'd also like to hear of the better ways to accomplish this - I am sure they exist - as well as your ideas for how else this could be used. happy.png 

12 replies

Forum|alt.badge.img+7
  • Scholar
  • 165 replies
  • February 3, 2017

Rhia Wieclawek

This is an awesome approach.

Whenever i have had to use this functionality, I have the manager field on the form (manually populated or auto populated through JavaScript. I little teaser for a future blog post!) and then use a rule on the panel set to hide using this formula:

not(userEquals(Manager,Current User))

Where manager is the named control of the manager field.

Using your method opens up the possibility of custom functions run based on a query string value. Awesome.


Forum|alt.badge.img+14
  • Scholar
  • 4631 replies
  • February 3, 2017

I use to use following script.

it takes supplied anchor from URL, and if it recognizes it's a control name or javascript control variable it translates it to respective control id. that makes browser to navigate to the control.

I found it independent of form/application and specific customized handling routine.

NWF.FormFiller.Events.RegisterAfterReady(function () {
   //check to see if any anchor is provided in URL
   if (window.location.hash.length){     
     //get the anchor and remove hash mark
     var anchorTag = window.location.hash.replace(/#/,'');
     //check to see if anchor is recognized as control's javascript variable
     if (NWF$('#' + window[anchorTag]).length){
         //set/change anchor to ID of control identified by javascript variable
         window.location.hash = "#" + NWF$("#" + window[anchorTag])[0].id;
      }else //check to see if anchor is recognized as control's name
        if (NWF$("[data-ControlName='" + anchorTag  + "']").length){                             
           //set/change anchor to ID of control identified by control name
           window.location.hash = "#" + NWF$("[data-ControlName='" + anchorTag  + "']").find('.nf-associated-control').attr('id');        
        }
    }
})
‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍

rhia
Forum|alt.badge.img+15
  • Author
  • Novice
  • 760 replies
  • February 3, 2017

‌ - this is interesting to me - as I am a total JavaScript newbie. I am wondering if you would mind giving a brief explanation of what each line is doing? That might be helpful for others as well!!


Forum|alt.badge.img+6
  • 95 replies
  • February 4, 2017

‌ Very cool, thanks a lot! :-)


rhia
Forum|alt.badge.img+15
  • Author
  • Novice
  • 760 replies
  • February 5, 2017

And thank YOU for your contributions as well, sir!


rhia
Forum|alt.badge.img+15
  • Author
  • Novice
  • 760 replies
  • February 5, 2017

Manager automatically populated through JavaScript!? Like, looking at the Current User's organizational hierarchy!? You have piqued my interest, sir!


Forum|alt.badge.img+7
  • Scholar
  • 165 replies
  • February 5, 2017

Exactly that, I will blog it on Monday. Queries the user profile for manager and populates people picker control. 


Forum|alt.badge.img+14
  • Scholar
  • 4631 replies
  • February 7, 2017

is it better now?


rhia
Forum|alt.badge.img+15
  • Author
  • Novice
  • 760 replies
  • February 7, 2017

Yes! This is excellent! Thank you so much ‌ <3


Forum|alt.badge.img+17
  • 1129 replies
  • February 10, 2017

+1 for having a cartoon image that looks like you!


rhia
Forum|alt.badge.img+15
  • Author
  • Novice
  • 760 replies
  • February 10, 2017

Well, I drew it, so it had better! I did freelance illustration for a long time  this is the top of a cartoon I did of myself as a mermanatee - manatees are awesome.

If you want a cartoon of yourself like that (you don't have to be half manatee) I'm glad to make one for you!


Forum|alt.badge.img+17
  • 1129 replies
  • February 11, 2017

I'm IN!