Expand my Community achievements bar.

Don’t miss the AEM Skill Exchange in SF on Nov 14—hear from industry leaders, learn best practices, and enhance your AEM strategy with practical tips.
SOLVED

Is there any way to find if resource exists using Java-script use api?

Avatar

Level 3

Hi All,

In java use API I can resolve a path(String) to resource and know if that resource exits or not. But in java-script use API, I am able to convert a path(String) to resource using  (granite.resource.resolve(path)) but how can I know if the string path which I converted to a resource exists in my JCR?

Thanks in Advance!!

-Raghava.

1 Accepted Solution

Avatar

Correct answer by
Employee

Do getResource() instead of resolve(), if it results in null then it doesn't exists.

View solution in original post

2 Replies

Avatar

Level 8

Hi,

Not pretty sure, but guess you might have to make use of normal java code which uses WCMUSEPojo.

You can await inputs from other community members too on this.

Avatar

Correct answer by
Employee

Do getResource() instead of resolve(), if it results in null then it doesn't exists.