Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
BedrockMission!

Learn More

View all

Sign in to view all badges

AEM 6.3 - How to read policy value from editable template initially

Avatar

Avatar
Validate 10
Level 2
sreekalyanip
Level 2

Likes

7 likes

Total Posts

40 posts

Correct Reply

0 solutions
Top badges earned
Validate 10
Validate 1
Boost 5
Boost 3
Boost 1
View profile

Avatar
Validate 10
Level 2
sreekalyanip
Level 2

Likes

7 likes

Total Posts

40 posts

Correct Reply

0 solutions
Top badges earned
Validate 10
Validate 1
Boost 5
Boost 3
Boost 1
View profile
sreekalyanip
Level 2

31-08-2018

I have a editable template where a component has a design dialog where the template author will enter the values.

1561460_pastedImage_0.png

1561478_pastedImage_7.png

and in the design dialog i have a node of select type where the data is bound by using datasource through a servlet where I need to fetch the data from the policy.

1561466_pastedImage_1.png

and the code for the servlet is as follows. If i dont give policyPath and just get the resource from request.getResource() i am getting contentpolicy as null.

1561468_pastedImage_2.png

initially when there are no policies a dynamic policy is being created when we get the resource and a nullpointer is being thrown.

1561472_pastedImage_4.png

So how to handle this initially that no null pointer is thrown and can say there are no policies.

Thanks,

Kalyani

Replies

Avatar

Avatar
Validate 25
Level 10
smacdonald2008
Level 10

Likes

1,409 likes

Total Posts

12,671 posts

Correct Reply

2,278 solutions
Top badges earned
Validate 25
Validate 10
Validate 1
Give back 900
Give back 600
View profile

Avatar
Validate 25
Level 10
smacdonald2008
Level 10

Likes

1,409 likes

Total Posts

12,671 posts

Correct Reply

2,278 solutions
Top badges earned
Validate 25
Validate 10
Validate 1
Give back 900
Give back 600
View profile
smacdonald2008
Level 10

31-08-2018

If you want to read data from a policy - then like any other AEM nodes - make sure you referencing the correct path if you want to read the node's properties.

For your code - where did you get it - are you referencing an Adobe doc? 

Avatar

Avatar
Validate 10
Level 2
sreekalyanip
Level 2

Likes

7 likes

Total Posts

40 posts

Correct Reply

0 solutions
Top badges earned
Validate 10
Validate 1
Boost 5
Boost 3
Boost 1
View profile

Avatar
Validate 10
Level 2
sreekalyanip
Level 2

Likes

7 likes

Total Posts

40 posts

Correct Reply

0 solutions
Top badges earned
Validate 10
Validate 1
Boost 5
Boost 3
Boost 1
View profile
sreekalyanip
Level 2

03-09-2018

I have used Adobe Experience Manager Help | Using Granite DataSource objects to populate AEM Touch UI objects  for binding the data to the dropdown.

For reading policies i have read in some forums that by using ContentPolicyManager to get the policy.