Change views based on User ID

A

Angie Penberthy

This is what I have been tasked to do, any suggestions
and code would be very helpful. Thank you in advanced,
maybe some day I can be assistance to you when I get
InfoPath figured out.
Angie

Task:

When someone opens the form, I need InfoPath to ask for
their employee#. Based on that employee number a view is
displayed. I started out with an onloadevent to prompt
for the value (employee#). I have no idea what the code
is to get the value. Once I had that value, I wanted to
set up a rule that said...IF = E1234 then show View
E1234. If = E4567 then show View 4567. Can someone tell
me if I am on a right track and if so, how would I go
about coding this.
Thanks,
Angie
 
E

ElVino

clo Angie

If you use a text box bound to a node you can then place a button next to it
and use some code like this:

function btnOK::OnClick(eventObj)
{
try

var sUser

sUser =
XDocument.DOM.selectSingleNode("/my:document_element/my:root/my:user_id").text

switch(sUser)
{
case '123':
XDocument.View.SwitchView("vw123");
break;
case '456':
XDocument.View.SwitchView("vw456");
break;
default:
XDocument.UI.Alert('UserID Unknown');
}
catch(err)
{
XDocument.UI.Alert(err.description)
}
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top