Title: How to define an Inbox and view as default Topic: Everytime a

Title: How to define an Inbox and view as default
Topic: Everytime a user starts a connection to SM the ToDO queue displays the last view displayed by
that user.
Resolution: Please follow up the next instructions
1- Create a button into the form called: sc.manage.sub.format.
 Button ID: 50
2- Create a new display option:







Screen ID: scm.advanced
Gui Option: 50
Text option: 1
Bank: 1
Text Alternative: Define as Default Inbox and View
Action: Do nothing
Include the following code to the JavaScript Tab:
--------------------------------------------------------------------------------var operator = new SCFile("operator");
var sql = "name = \"" + system.functions.operator() + "\"";
var rc = operator.doSelect(sql);
if (rc == RC_SUCCESS)
{
operator.default_view=system.vars.$L_inbox;
operator.default_queue=system.vars.$L_switch_inbox;
operator.doUpdate();
print("Inbox and View succesfully defined as default.");
}
---------------------------------------------------------------------------------
3- Create a new JavaScript from the scriptLibrary table (“sl” from the command prompt of SM)
 Name: OperatorQueue_View
 Code:
-------------------------------------------------------------------------------//Created by Luis Guillermo Alfaro Hurtado
// 11/21/12
//OPTIONS 1=Return Queue 2=Return View
function ObtainQueueView(option)
{
var operator = new SCFile("operator");
var sql = "name = \"" + system.functions.operator() + "\"";
var rc = operator.doSelect(sql);
if (rc == RC_SUCCESS)
{
if (option==1)
{
return operator.default_queue;
}
if (option==2)
{
return operator.default_view;
}
}
}
--------------------------------------------------------------------------------
4- Modify the format control called: login.Default

Add these 4 lines in the initialization expressions:
$G.default.queue=""
$G.default.queue=jscall("OperatorQueue_View.ObtainQueueView", 1)
$G.default.view=""
$G.default.view=jscall("OperatorQueue_View.ObtainQueueView", 2)

Add the following subroutine:
5- Create two fields in the operator dbdict
 default.view : varchar(200)
 default.queue: varchar(200)