getValue() doesn't exist in session.xml and include.xml doesn't either | Community
Skip to main content
Level 2
February 23, 2023
Solved

getValue() doesn't exist in session.xml and include.xml doesn't either

  • February 23, 2023
  • 2 replies
  • 1146 views

Hi, Im trying to use the xtk.session.getValue("name") method in my javascript file and also do a xtk.include("xtk:session.js") function with that. But when I look in datakit\xtk\eng\schema the include.xml doesnt exist. And when I look in the session.xml the method getValue() doesnt either.

 

How can I go on from here?

 

Best Regards,

Martin

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by akshaaga

@marting66652718 ,

If you're having trouble using xtk.session.getValue() or xtk.include() in your JavaScript file, there are a few things you can check:

1. Ensure you have included the session.js file in your JavaScript file. You can do this by adding the following line at the top of your JavaScript file:
xtk.include("xtk:session.js");
This line tells the platform to include the session.js file in your script, which contains the xtk.session.getValue() method.

2. In Adobe Campaign Classic, JavaScript files can be run on either the client-side (in the web browser) or the server-side (on the server). The xtk.session.getValue() and xtk.include() methods are only available on the server-side, so ensure that your JavaScript file is executed server-side.

3. Check for errors in your JavaScript file. If your JavaScript file has syntax errors or other issues, it may prevent the xtk.session.getValue() or xtk.include() methods from working correctly. Check the console logs for any error messages that may be helpful.

2 replies

Manoj_Kumar
Community Advisor
Community Advisor
February 23, 2023

Hello @marting66652718 

 

To include any file in your JS file, you can use this syntax

loadLibrary('PATH_OF_JS')

Also, The getValue method is not available in the session class.

 

You can use options to save temporary data as key-value pairs.

set option value

setOption("KEY","VALUE");

 

 

Get the value of option

getOption('KEY');

 

Manoj  | https://themartech.pro
akshaaga
Adobe Employee
Adobe Employee
February 27, 2023

@marting66652718,

In ACC, Xtk code is used for server-side scripting and to interact with the platform's API.

The xtk.session.getValue() method is a built-in function, which allows you to retrieve a value stored in the current session. The xtk.include() function is used to include other Xtk scripts or functions into your current script.

Regarding your question about the missing files in the datakit\xtk\eng\schema directory, it's important to note that these files are not intended to be edited or modified directly.

Instead, they are generated and updated automatically by the platform based on the configuration of your instance.

If you are unable to find the include.xml file or the getValue() method in session.xml, it's possible that your ACC instance has been customized or modified in some way.

You should be able to use the "xtk.session.getValue()" method and the "xtk.include()" function in your Xtk script without having to worry about the underlying implementation details.

 

 

Level 2
February 27, 2023

Hello!

 

Im not able to use the getValue() method in my javascript file. Nor am I able to use the Include();

 

Best Regards

Martin

akshaaga
Adobe Employee
akshaagaAdobe EmployeeAccepted solution
Adobe Employee
February 27, 2023

@marting66652718 ,

If you're having trouble using xtk.session.getValue() or xtk.include() in your JavaScript file, there are a few things you can check:

1. Ensure you have included the session.js file in your JavaScript file. You can do this by adding the following line at the top of your JavaScript file:
xtk.include("xtk:session.js");
This line tells the platform to include the session.js file in your script, which contains the xtk.session.getValue() method.

2. In Adobe Campaign Classic, JavaScript files can be run on either the client-side (in the web browser) or the server-side (on the server). The xtk.session.getValue() and xtk.include() methods are only available on the server-side, so ensure that your JavaScript file is executed server-side.

3. Check for errors in your JavaScript file. If your JavaScript file has syntax errors or other issues, it may prevent the xtk.session.getValue() or xtk.include() methods from working correctly. Check the console logs for any error messages that may be helpful.