Skip to main content
Deepti_v_Jain
Level 2
May 8, 2015
Solved

Is there a way to set jcr:createdBy property value while creating page programatically?

Is there a way to set jcr:createdBy property value while creating page programatically?

aanchal-sikka
aanchal-sikkaAccepted solution
Community Advisor
December 6, 2023

Following properties of a page are created automatically and protected.

AEM will not allow us to edit this information. It is retrieved from the Session object,

 

 

Aanchal Sikka

4 replies

Adobe Employee
May 12, 2015

Hello,

This property is defined in the mix:created node and should automatically be created when you create a page either manually or programmatically. Be sure to use the PageManager to create the page in your code.

Translate
August 15, 2015

We're using the pageManager object to create the page. After the page is created the jcr:createdBy property is taken from the user ID available in the session object which is taken from the slingRequest object.

Now is there any possibility to update/override this property programatically?

Translate
aanchal-sikka
Community Advisor
aanchal-sikkaCommunity AdvisorAccepted solution
Community Advisor
December 6, 2023

Following properties of a page are created automatically and protected.

AEM will not allow us to edit this information. It is retrieved from the Session object,

 

 

Translate
Aanchal Sikka
AmitVishwakarma
Community Advisor
Community Advisor
January 18, 2025

Hi @deepti_v_jain 

Yes, you can set the jcr:createdBy property programmatically when creating a page in AEM. To do this:

  1. Retrieve the JCR node of the page using PageManager or Page API.
  2. Set the jcr:createdBy property to the desired value (e.g., "admin").
  3. Save the session to persist the changes.

This allows you to specify who created the page when it's being created programmatically.

Translate
Amit Vishwakarma - Adobe Commerce Champion 2025 | 17x Adobe certified | 6x Adobe SME