Possible to hide fields based on Portal address?

RWHeals
Tera Contributor

I have a record producer that is shared in two different portals.  Portal A and Portal B.  If a user is accessing the record producer from Portal A, I want to hide certain fields.  If Portal B, I want to show the fields.  Is this possible?

 

Also, on the same note.  For a field called contact, for Portal A we want to reference the sys_user table, while in Portal B we want to reference the contacts table instead.  Is this possible.

 

 

1 ACCEPTED SOLUTION

Tai Vu
Kilo Patron
Kilo Patron

Hi @RWHeals,

Let's try this way.

1. Create your OnLoad Client Script

2. Define a variable and retrieve the URI with "top.location.href". Sample:

var uri = top.location.href;

3. Compare to the Portal Suffix, do the corresponding action (here is make the field visible and invisible)

 

Let me know if it works for you!

 

Cheers,

Tai Vu

View solution in original post

4 REPLIES 4

Weird
Mega Sage

Hmm, it's been a while since I've done any checks for URL, but you could try if a client script can read the url with 

var url = window.parent.location.href;
You could then say something
if(url.indexOf("yourportalsuffix") > -1){
g_form.setDisplay("your_field", false);
}


This is just something I think might work and I didn't test it, but it should give you an idea on what you can do to hide fields in certain portals. You'll just need to get the URL and then you can check if it contains the portal suffix.

RWHeals
Tera Contributor

Thank you.  This worked only when using Tai Vu's:

var uri = top.location.href;

 

Tai Vu
Kilo Patron
Kilo Patron

Hi @RWHeals,

Let's try this way.

1. Create your OnLoad Client Script

2. Define a variable and retrieve the URI with "top.location.href". Sample:

var uri = top.location.href;

3. Compare to the Portal Suffix, do the corresponding action (here is make the field visible and invisible)

 

Let me know if it works for you!

 

Cheers,

Tai Vu

RWHeals
Tera Contributor

In combination with "Weird's" answer, this worked.