Difference between revisions of "Incoming Method Parameters"

From AgileApps Support Wiki
imported>Aeric
imported>Aeric
 
(12 intermediate revisions by the same user not shown)
Line 1: Line 1:
__TOC__
__TOC__
===Standard Object Parameters===
When a Java method is invoked by a [[Rule]] or [[Macro]], the record's fields are passed to the method in a [[Parameters Class|Parameters]] instance. That instance contains the object's custom fields, as well as the object's [[Standard Fields]]. The following convenience parameters are passed, as well:
When a Java method is invoked by a [[Rule]] or [[Macro]], the record's fields are passed to the method in a [[Parameters Class|Parameters]] instance. That instance contains the object's custom fields, as well as the object's [[Standard Fields]]. The following convenience parameters are passed, as well:
:{| border="1" cellpadding="5" cellspacing="1"
:{| border="1" cellpadding="5" cellspacing="1"
Line 11: Line 12:
|}
|}


===Object Fields===
===Field Parameters===
When parameters are returned by a search, they contain the object fields specified in the search. When parameters are passed to a Java method by a [[Rule]] or [[Macro]], they contain all of the fields for the current record.
When a Parameters instance is returned by a search, it contains the fields specified in the search. When passed to a Java method by a [[Rule]] or [[Macro]], it contains all of the fields for the current record.


Add this line to your code above to put a complete list of parameters into the debug log:
Add this line to your code above to put a complete list of parameters into the debug log:
:<syntaxhighlight lang="java" enclose="div">
:<syntaxhighlight lang="java" enclose="div">
// Generate a newline-separated list of parameters
// Generate a newline-separated list of parameters
debug( params.toString().replace(",", ",\n") );
Logger.info( params.toString().replace(",", ",\n"), "YourClassName" );
That code assumes that your parameters object is named <tt>params</tt>. It adds a linebreak after each comma in the string representation of the parameters hashmap, to improve readability.
{{Tip| To get a really good listing, copy the results into a text editor.}}
</syntaxhighlight>
</syntaxhighlight>
The code assumes that your parameters object is named <tt>params</tt>. It adds a linebreak after each comma in the string-representation of the Parameters hashmap, to improve readability.
{{Tip| To see the listing clearly, copy the results into a text editor.}}


===Additional Macro Parameters===
===Additional Macro Parameters===
Line 29: Line 31:
| p_service_domain || Ex: <tt>acme.claimdynamics.com</tt>
| p_service_domain || Ex: <tt>acme.claimdynamics.com</tt>
|-
|-
| user_id || The id of the record in the User object.
| userId || The current user's ID.
|}
|}


Line 39: Line 41:
| serverName ||  Ex: <tt>acme.claimdynamics.com</tt>
| serverName ||  Ex: <tt>acme.claimdynamics.com</tt>
|-
|-
| userId || The id of the record in the User object.
| user_id || The current user's ID.


|-  
|-  
Line 47: Line 49:
|-  
|-  
| JSESSIONID || The session identifier. (Generally used only when making a REST API call.)
| JSESSIONID || The session identifier. (Generally used only when making a REST API call.)
|-
| AWSELB|| The AWSELB parameter is injected by the load balancer and after login, it is required for every subsequent request. This parameter directs the requests to the server where the session is  established. While making REST requests, we recommended you to retrieve the cookie at the time of login, and send this cookie along with each subsequent request. 
For the cloud based platform, (for example, agileappslive.com) we have three web servers. Requests are directed to the web servers by a load balancer which implements session based load balancing. 
|-  
|-  
| isCaseDynamicsSession || True (=1) if the ServiceDesk application is running. Else false (=0).
| isCaseDynamicsSession || True (=1) if the ServiceDesk application is running. Else false (=0).
|-  
|-  
| login || {{TBD|???}}
| login || not used
|-  
|-  
| layout_id || The ID of the [[Form]] that is currently being used to display the record.
| layout_id || The ID of the [[Form]] that is currently being used to display the record.
Line 79: Line 84:
| lang || User's language identifer. For example: <tt>en</tt>
| lang || User's language identifer. For example: <tt>en</tt>
|}
|}
===Current Session Information===
In addition to the incoming Parameters, these APIs can be used to get information about the current user and the current session:
:* [[getEnv]]
:* [[getLoggedInUserInfo]]

Latest revision as of 09:43, 25 January 2018

Standard Object Parameters

When a Java method is invoked by a Rule or Macro, the record's fields are passed to the method in a Parameters instance. That instance contains the object's custom fields, as well as the object's Standard Fields. The following convenience parameters are passed, as well:

Field name Notes
name The record's "name", as specified by the object's Record Locator definition. For cases, it's the unique case number. For users, it's the user's full name. And so on.
is_deleted True (=1) if the record is in the recycle bin. Otherwise false (=0).
userPrimaryTeamId The current user's team affiliation.

Field Parameters

When a Parameters instance is returned by a search, it contains the fields specified in the search. When passed to a Java method by a Rule or Macro, it contains all of the fields for the current record.

Add this line to your code above to put a complete list of parameters into the debug log:

// Generate a newline-separated list of parameters
Logger.info( params.toString().replace(",", ",\n"), "YourClassName" );

The code assumes that your parameters object is named params. It adds a linebreak after each comma in the string-representation of the Parameters hashmap, to improve readability.

Thumbsup.gif

Tip: To see the listing clearly, copy the results into a text editor.

Additional Macro Parameters

These values have counterparts in the rule parameters, but have different names:

Field name Notes
p_service_domain Ex: acme.claimdynamics.com
userId The current user's ID.

Additional Rule Parameters

These values are included when a Java method is invoked from a Rule. The first two are equivalent to the additional macro parameters shown above. A number of useful session values are included as well, along with values that pertain to the current user:

Field name Notes
serverName Ex: acme.claimdynamics.com
user_id The current user's ID.
current_application The ID of the application the user is running.
JSESSIONID The session identifier. (Generally used only when making a REST API call.)
AWSELB The AWSELB parameter is injected by the load balancer and after login, it is required for every subsequent request. This parameter directs the requests to the server where the session is established. While making REST requests, we recommended you to retrieve the cookie at the time of login, and send this cookie along with each subsequent request. 

For the cloud based platform, (for example, agileappslive.com) we have three web servers. Requests are directed to the web servers by a load balancer which implements session based load balancing.

isCaseDynamicsSession True (=1) if the ServiceDesk application is running. Else false (=0).
login not used
layout_id The ID of the Form that is currently being used to display the record.
user.id
user.primaryteamid
userPrimaryTerritoryId
user_local_time
user User's full name. For example: Aaron Acme
user.firstname
user.lastname
user.primaryteamname
user.primaryroleid
user.email
userEmail
Email address
lang User's language identifer. For example: en

Current Session Information

In addition to the incoming Parameters, these APIs can be used to get information about the current user and the current session: