Use Api in JS

Avatar

Avatar

Shaheena_Sheikh

Avatar

Shaheena_Sheikh

Shaheena_Sheikh

21-02-2021

I have create a custom js file in a clientlib with category dam.gui.coral.metadataeditor. I have added the below code to my JS:

"use strict";

use(function () {
var path = currentPage.path;
});

When I open the Properties page for my asset this JS loads. But I am seeing a console error:

Uncaught ReferenceError: Use is not defined at <myjsfile.js:2>

I am not able to use the Use Api in my javascript

View Entire Topic

Avatar

Avatar

raj_mandalapu

MVP

Avatar

raj_mandalapu

MVP

raj_mandalapu
MVP

21-02-2021

The js use API execute at the server-side and we use this in components business logic, but I never tried this by adding category dam.gui.coral.metadataeditor,  and in this case, based on my understanding you are calling use API in metadata validation, I think this will not work. you need to use JS to get the page path and other business logic.

This is my understanding let's hear from other community members