License

The context class contains a set of methods used to handle the rights granted by the license.

1. How Sage X3 manages the license

The main principles of license management are:
* In order to be granted the right to run the V12 platform, you must have at least a license file associated to a policy file:
* the policy file defines a set of elements which use can be controlled;
* the license file defines the authorizations granted to the user for every element listed in the policy file.
* Additional license files can be installed, for instance, to grant rights to specific or vertical extensions as well as to other product lines.
* The authorization depends on the folder as well as on the user's role operating the connection.
* A user can access the current license rights through a dedicated administration function.
* A developer has access to all these licensed elements in order to know if a given resource can be used without exceeding the granted rights.

2. Methods to access to the license information

The following table describes the context methods available

ElementMethod codeParametersReturn
Activity codeAGETLICACVactivity code (Char)
  • [V]CST_ATRUE: the activity code can be activated
  • [V]CST_AFALSE: the activity code cannot be activated
FunctionAGETLICFCTfunction code (Char)
  • [V]CST_ATRUE: the function can be used
  • [V]CST_AFALSE: the function cannot be used
Parameter kitAGETLICKITparameter kit (Char)
  • [V]CST_ATRUE: the parameter kit can be installed
  • [V]CST_AFALSE: the parameter kit cannot be installed
LanguageAGETLICLANlanguage code (Char)
  • [V]CST_ATRUE: the user can connect with the language code
  • [V]CST_AFALSE: the user cannot connect with the language code
LegislationAGETLICLEGlegislation code (Char)
  • [V]CST_ATRUE: the user can use functions dedicated to the legislation
  • [V]CST_AFALSE: the user cannot use functions dedicated to the legislation
ModulesAGETLICMODmodule (Integer)
  • [V]CST_ATRUE: the user can use functions belonging to the module
  • [V]CST_AFALSE: the user cannot use functions belonging to the module
Parameter valuesAGETLICPARparameter code (Char)
parameter value returned (Char)
  • [V]CST_ATRUE: the parameter is controlled by the license
  • [V]CST_AFALSE: the parameter is not controlled by the license the parameter value is not filled
License filesAGETLICLICproduct code(Char)
  • [V]CST_ATRUE: the license file exists for the product code.
  • [V]CST_AFALSE: the license file does not exist for the product code
License filesAGETLICEXPIREDproduct code(Char)
  • [V]CST_ATRUE: the license is expired for the product code
  • [V]CST_AFALSE: the license file is not expired for the product code
Partner ID in license fileAGETLIC_PARTNERIDproduct code(Char)
  • Returns the partner ID code associated with the product code
Product version in license fileAGETLIC_PRODUCTVERproduct code(Char)
  • Returns the version number associated with the product code
Policy code in license fileAGETLIC_POLICYCODEproduct code(Char)
  • Returns the policy code associated with the product code
Policy version in license fileAGETLIC_POLICYVERproduct code(Char)
  • Returns the policy version associated with the product code
Serial number in license fileAGETLIC_SERIALproduct code(Char)
  • Returns the serial number associated with the product code

Note: The authorization on a resource is granted if one of the following conditions is fulfilled:
* The policy file does not define the resource as controlled.
* The policy file includes a control on the resource and the license file grants the right on it.

3. Examples

 # A Sales order related function can be called only if GESSOH is authorized by the license.If fmet this.ACTX.AGETLICFCT("GESSOH")=[V]CST_ATRUEOK=fmet this.GENERATE_SALESORDEREndif# A Serial number control can be called only if SER activity code is authorized by the license.If fmet this.ACTX.AGETLICACT("SER")=[V]CST_ATRUEGosub CONTROL_SERIAL_NUMBEREndif# Is the Spanish legislation code allowed?If fmet this.ACTX.AGETLICLEG("SPA")=[V]CST_ATRUECall IVA_SPAINEndif# Is there a valid license file for the vertical "MYV" ?# If yes, allow execution in read-only mode if expired, otherwise allow full executionIf fmet this.ACTX.AGETLICLIC("MYV")=[V]CST_ATRUEIf fmet this.ACTX.AGETLIC_EXPIRED("MYV")=[V]CST_ATRUERETURNVAL=func MYVERTICAL.FUNCTION1(PARAM,"READONLY")ElseRETURNVAL=func MYVERTICAL.FUNCTION1(PARAM,"UPDATE")EndifEndif# How many fixed assets can be created according to the license ?Local Integer OK, MAXASSETSLocal Char RET_VAL(20)OK=fmet this.ACTX.AGETLICPAR("MAXFIXEDASSETS",RET_VAL)If OK=[V]CST_ATRUEMAXASSETS=val(RET_VAL)ElseMAXASSETS=0Endif# Build a message with the characteristics of a productLocal Char MESSAGE_LICENCE(200),PROD(20)PROD="MY_VERT"MESSAGE_LICENSE="Licence #"-fmet this.ACTX.AGETLIC_SERIAL(PROD)& -"granted by"-fmet this.ACTX.AGETLIC_PARTNERID(PROD)& -"for version"-fmet this.ACTX.AGETLIC_PRODUCTVER(PROD)& -"with policy code equal to"-fmet this.ACTX.AGETLIC_POLICYCODE(PROD)& -"(rev"-fmet this.ACTX.AGETLIC_POLICYVER(PROD)+")"## Returns : Licence #314159 granted by SOFT_VERTICAL for version 2.72 with policy code equal to VERT (rev 2)## If the licence file contains the following lines:# {# "partnerId": "SOFT_VERTICAL",# "productCode": "MY_VERT",# "productVersion": "2.72",# "policyCode": "VERT",# "policyVersion": "2",# "serial": "314159"# }