What's the best practice in Perspective for returning a result from a popup window to a calling function, particularly when the popup window is invoked from multiple views and the return value is written to a different place for each call? For example, in one instance the return value is written to a session custom prop, and in another the return value is written to a view custom prop.
Found this thread but it appears to apply to Vision only.
So if I'm understanding correctly, you're suggesting the calling function includes a parameter specifying a unique message handler that gets the return value, and then create a message handler that writes that value to the desired property. That sounds like it would work but seems somewhat cumbersome.
I'm also looking into passing a property path to the popup and using setattr() to write the return value to a specific session custom prop, and if I want a view to 'receive' the result, I can just bind the view prop to the session prop. This approach has its own tradeoffs, but for what I'm doing it seems like it might be a tad cleaner, if it works.
This is the definitive answer for most cases. If there's any chance of multiple message handlers receiving the message, the caller should also include a unique key that the message handler can filter against.
An alternative, much cleaner IMNSHO, is to use my Integration Toolkit's pageVarMap() expression and scripting functions. Use the expression function in the receiving view, and the scripting function in the sending view. The sending view would call bvm.refresh() to cause the receiving view's expression to re-execute with the result.
(This technique is also quite handy when using a series of main views in a workflow, and you want to support multiple independent tabs using the workflow.)