https://netsuiteprofessionals.com logo
#suitecommerce
Title
# suitecommerce
l

Lucas

04/01/2022, 3:11 AM
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

Steve Goldberg

04/05/2022, 10:25 AM
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

Lucas

04/18/2022, 4:25 AM
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

Steve Goldberg

04/19/2022, 10:33 AM
If it's for an SCA site then this is generally fine
l

Lucas

04/19/2022, 10:34 AM
Yes it's for SCA only..