Jump to content
  • 0

Redirect Based On Access Level


ababcock

Question

I am trying to create a button that connects users to a details page depending on their access level. Here is what I have in the button right now (URL changed):

 

<input onclick="window.open('https://sample.org/edit.html?ID=[@field:Contact_Sheet_Number]')" type="button" value="Edit Content" />

 

I would like to adjust that so it directs

- user level users to one page: https://sample.org/edit.html

- management level users to one page: https://sample.org/edit1.html

- admin level users to one page: https://sample.org/edit2.html

 

I was directed to this page for help: http://howto.caspio.com/tech-tips-and-articles/common-customizations/create-user-specific-redirect-after-login/ which explains redirect after login based on access level, but I was wondering if I could just insert the HTML code into the HTML box my button is in (rather than a standalone login screen). Here is the code they recommend: 

 

<script>
if("[@authfield:Admin]" == "Yes"){
window.location = "http://www.mysite.com/admin.html";
}
else if ("[@authfield:Manager]" == "Yes"){
window.location = "http://www.mysite.com/manager.html";
}
else{
window.location = "http://www.mysite.com/employee.html";
}
</script>

Link to comment
Share on other sites

4 answers to this question

Recommended Posts

  • 0
  • 0

I am trying to do something like the original post. I have two different Single Record Update forms for two different departments. The records in my tabular report are in 2 groups - Residential and Commercial. I am trying to have only 1 update 'button' on the tabular report that will redirect to the correct SRU Form - Either Residential SRU or Commercial SRU - depending on the value of a field.

I have a Yes/No field named Commercial_Service. If this is checked, it is a Commercial record. If not, it is a Residential record. Hence, if it is checked, I want the button to redirect the user to Commercial SRU form, and if unchecked, redirect to Residential SRU form.

Any ideas?

Link to comment
Share on other sites

  • 0

Hi @kpcollier -  Have you tried to create a calculated field that will have a conditional link based on certain criteria? Perhaps like this one:

CASE WHEN Commercial_Service is checked
THEN  Commercial SRU form link
ELSE  Residential SRU form link

Then this calculated field can be referenced to another HTML Block for <a> tag or button. 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...