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
Automatically set "My Screens"
Moderator: Phil Barton
Re: Automatically set "My Screens"
You can open a screen by doing something like this:
Just use the appropriate order number and replace "SPExpressOrderEntry" with the name of the screen you want to open.
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));
Pradeepa Chandramohan
Software Engineer
SoftPro
Software Engineer
SoftPro
Re: Automatically set "My Screens"
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?
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?
Re: Automatically set "My Screens"
Yes. Just pass in the required screen layout in the code below.
I hope this answers your question!
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);
Pradeepa Chandramohan
Software Engineer
SoftPro
Software Engineer
SoftPro
Re: Automatically set "My Screens"
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?
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?
Re: Automatically set "My Screens"
We don't support this currently, but will log a suggestion for future release.
Pradeepa Chandramohan
Software Engineer
SoftPro
Software Engineer
SoftPro
Re: Automatically set "My Screens"
Ok, thanks so much for your help.