```define('SCA.SCAApi.Api' , [ 'Application', ...
# suitecommerce
l
Copy code
define('SCA.SCAApi.Api'
,	[
		'Application',
        'Models.Init',
		'Configuration'
	]
,	function (
		Application,
        ModelsInit,
		Configuration
	)
{
	'use strict';
		Application.on('before:LiveOrder.addLine', function (model, currentLine)
		{
			try {
							//var isLoggedIn = ModelsInit.session.isLoggedIn2() ? 'T' : 'F',
							//isRecognized = ModelsInit.session.isRecognized() ? 'T' : 'F',
							//isSCAConfigDisabled = Configuration.get('SCAConfig') && Configuration.get('SCAConfig').isSCAConfigDisabled;
							  
                              ModelsInit.context.setSessionObject('isItemAdded', true);
							
			} catch (e) {
				nlapiLogExecution("ERROR", "ERROR", JSON.stringify(e))
			} 
		});
});
s
Will your
if
statement ever evaluate correctly? You're setting
isLoggedIn
and
isRecognized
to be either
T
or
F
, which aren't values JavaScript recognises as true or false in conditional statements.
l
Ok.. Consider I corrected the if statement. In that case is it good to use in extension? @Steve Goldberg
Corrected the code for now, I am bit concern of using using '*Application*', '*Models.Init*' as dependency and '*Application.on('before:LiveOrder.addLine'* method, in SCA extension.. I am not able to find out any documentation related to this, So trying to understand thought on this..... Note that, We will not going to deploy this extension, will properly ask our customer to setup this at their end Manually by giving some instruction document.
Thank in advanced
s
If it's for an SCA site then this is generally fine
l
Yes it's for SCA only..