Usage

1.Client Side Context Usage

For Callout: While working with callouts, you can get context as first parameter of callout function. 

For Forms: You can create context object for forms like var ctx=VIS.Env.getCtx();   

  

 Use in callout 

ctx.getContextAsInt(windowNo, "column name"); // Get integer value of column from context 

ctx.setContext(windowNo, ColumnName, Value); 

ctx.getContext(ColumnName); // Get value of column from context 

  

Use in Form 

ctx.getContext(Key); // Get value of column from context 

  

Use in both Callout and Form 

  

ctx.getAD_Org_ID(); // Get Login Org ID 

ctx.getAD_Client_ID(); // Get Login Client ID 

ctx.getAD_User_ID(); // Get Login User ID 

  

ctx. setContext("key",value);  

                 OR   

VIS.Env.getCtx().setContext("key",value); 

 

2.Server Side Context Usage

For custom controllers 

Ctx vCtx = Session["ctx"] as Ctx; 

then use vCtx in model classes. 

There are some predefined functions in Context class like; 

vCtx.GetAD_User_ID()       // return logged in user id 

vCtx.GetAD_Role_ID()   // return user’s role id 

vCtx.GetAD_Org_ID()    // Get Login Org ID 

vCtx.GetAD_Client_ID()               // Get Login Client ID 

vCtx.GetContext("Key")               // Get Context value according to given key 

For example: Need to Get current account schema the use below  

vCtx.GetContext("$C_AcctSchema_ID") 

Here $C_AcctSchema_ID is key to which value user want to get from context 

vCtx.SetContext("Key",value)   // Set key and its value in  context 

  

For Processes 

You can get Context object in process classes from parent class of processes.  SvrProcess is parent class for all the processes. You can get context information using GetCtx(). 

  

GetCtx().GetAD_User_ID()       // return logged in user id 

GetCtx().GetAD_Role_ID()   // return user’s role id 

GetCtx().GetAD_Org_ID()         // Get Login Org ID 

GetCtx().GetAD_Client_ID()     // Get Login Client ID 

GetCtx().GetContext("Key")    // Get Context value according to given key 

GetCtx().SetContext("Key",value)         // Set key and its value in  context