Expand my Community achievements bar.

SOLVED

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

Avatar

Level 3

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

1 Accepted Solution

Avatar

Correct answer by
Employee Advisor

@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.

View solution in original post

5 Replies

Avatar

Community Advisor

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
     Find me on LinkedIn

Avatar

Employee Advisor

@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.

 

 

Avatar

Level 3

Hello!

 

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

 

Best Regards

Martin

Avatar

Correct answer by
Employee Advisor

@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.

Avatar

Administrator

Hi @marting66652718,

Did @akshaaga's suggestions help you resolve your issue or do you still need more help here? Do let us know.

Thanks!



Sukrity Wadhwa