Automatically set "My Screens"

Discussions related to SoftPro Select user interface development.

Moderator: Phil Barton

Post Reply
mlevi
Posts: 53
Joined: Mon Dec 01, 2014 2:33 pm

Automatically set "My Screens"

Post by mlevi »

We'd like to implement code that once an order is opened, if certain criteria (based on order data) are met, the code should set the Screen to display for that order.

Do shell packages have the ability to automatically set the "My Screen"?

Thanks
Pradeepa
Posts: 37
Joined: Fri Oct 03, 2008 1:22 pm

Re: Automatically set "My Screens"

Post by Pradeepa »

You can open a screen by doing something like this:

Code: Select all

SelectServer sps = GetService<SelectServer>();
IShell shell = GetService<IShell>();

IOrderStore orderStore = sps.GetService<IOrderStore>();
IOrderInfo oi = orderStore.Orders.Where(o => o.Number == "2015020001").FirstOrDefault();

Uri orderUri = new Uri(string.Format(String.Format("{0}://./{1}?id={2}#target={3}&name={4}&contextid={5}", "sp-select", "ordertracking/order", oi.Identifier.Guid, "Screen", "SPExpressOrderEntry", oi.Identifier.Guid)));
shell.OpenStandardEditor(new OrderUri(orderUri, OrderKind.Order));
Just use the appropriate order number and replace "SPExpressOrderEntry" with the name of the screen you want to open.
Pradeepa Chandramohan
Software Engineer
SoftPro
mlevi
Posts: 53
Joined: Mon Dec 01, 2014 2:33 pm

Re: Automatically set "My Screens"

Post by mlevi »

Thank you.

Just to clarify, we trying to do something different. When an order is open in the GUI, the ribbon has a button that says "My Screens". A user can go ahead, click that button which brings up a dialog to select a new screen, and once the user clicks "OK", the document layout changes according to that screen selection.

Can that be done programmatically from a shell package?
Pradeepa
Posts: 37
Joined: Fri Oct 03, 2008 1:22 pm

Re: Automatically set "My Screens"

Post by Pradeepa »

Yes. Just pass in the required screen layout in the code below.

Code: Select all

ISecurityManager secMgr = sps.GetService<ISecurityManager>();
ISecurityUser user = secMgr.GetUser(sps.AuthenticatedUserID);
IScreenManager screenMgr = sps.GetService<IScreenManager>();

List<IScreenLayoutInfo> screenLayoutInfos = screenMgr.ScreenLayouts.AssociatedTo(user).ToList();
screenMgr.ChangeCurrentUserDefaultScreenLayout(screenLayoutInfos[0].ID);
I hope this answers your question!
Pradeepa Chandramohan
Software Engineer
SoftPro
mlevi
Posts: 53
Joined: Mon Dec 01, 2014 2:33 pm

Re: Automatically set "My Screens"

Post by mlevi »

Yes it does. Thank you very much.

Can this be executed on a per order tab basis? We really want to set the layout based on some order data once a user opens a order. Is that possible at all?

Right now we are using the IWindowManager.ActiveDocumentChanged event to examine the order data, and then running the code provided. It appears to set the default screen, but not reset the layout of the tab that has been opened.

Is it possible to reset the layout of the opened tab at that point?
Pradeepa
Posts: 37
Joined: Fri Oct 03, 2008 1:22 pm

Re: Automatically set "My Screens"

Post by Pradeepa »

We don't support this currently, but will log a suggestion for future release.
Pradeepa Chandramohan
Software Engineer
SoftPro
mlevi
Posts: 53
Joined: Mon Dec 01, 2014 2:33 pm

Re: Automatically set "My Screens"

Post by mlevi »

Ok, thanks so much for your help.
Post Reply