Jump to content
Salesforce and other SMB Solutions are coming soon. ×

How to tell if the script on a portal record or not.


Tim Harris
 Share

Recommended Posts

Here is a small problem that I'm sure there is a much easier way to fix than the way I'm doing it.

 

I have a table that has a self-join relationship. There are layouts where the data is displayed from the table and others that are in a portal (vis the self join).

 

The user can run the same script from either a protal or the main layout. The script updates various fields in the table - but it needs to correctly access that via the correct contex (table or related table). At the moment the script is littered with such things like "If not Get ( PortalRowNumber);" to work out if the next action should be via the relationship or not.

 

Wondering if there was a better way of doing it. Like - can I tell if the button was on the portal at the time as set some global field that would be correct for the script - portal or not.

Link to comment
Share on other sites

Go to the screen where the button is in the portal.

 

Click the button in Layout Mode. Bring up the "Button Setup" menu for the button, and, from there, the "Specify Script" options screen. Look down at the bottom: see where it says "Optional Script Parameters"?

 

Type "Portal Version". Click "OK". Click "OK".

 

Open your ScriptMaker. Edit the script, like so:

 

If [Get(ScriptParameter=Portal Version]

..Go to Related Record [Portal TableOccurrenceName]

End If

 

from that point onward, the script should behave the same way as it would for the screen where the button was right there on the local record to begin with, yes?

 

If you don't want the clicking of the button to navigate the user away from the record they started on, and the relationship is a selfjoin so you can't just go to original layout to return the user focus to their starting point after the script has run, trap for some unique identifier such as the serial number of the original record (put it in a $Variable before you go to related portal record), then after all other script steps,

 

If [Get(ScriptParameter) = "Portal Version"]

..Enter Find Mode []

..Set Field [Table::Serial Number, $Variable]

..Perform Find []

End If

Link to comment
Share on other sites

I'm doing the not Get ( PortalRowNumber) thing at the moment. But the script has everything in it twice one for when i'm working in the poprtal and one for when i'm note. I'm mainly using set field commands and was wondering if there was a funky way of avoiding the duplicated script line. I can post the script if that helps people understand the problem.

 

Tim

Link to comment
Share on other sites

How about something like:

 

If [ Get ( ScriptParameter) ]

Go to Related Record [New Window]

End If

>

If [ Get ( ScriptParameter) ]

Close Window

End If

 

The script parameter can be Get (PortalRowNumber) or simply 0 for the button outside the portal, and 1 for the button inside.

Link to comment
Share on other sites

 Share



×
×
  • Create New...

Important Information

Terms of Use