When i apply work flow page builder gives exception

Muhammad Kaleem asked on April 3, 2019 14:16

when i apply workflow to pages in pages applicaion when my page is unpublish it gives exception as "Page builder is not initialized. Call 'HttpContext.Kentico().PageBuilder().Initialize(

Recent Answers


Zach Perry answered on April 3, 2019 18:34

What is your controller code doing?

Are you initializing page builder in it? If not, you need to read the documentation.

If you are, and are retrieving a page before you initialize page builder, make sure you are handling retrieving unpublished content and aren't throwing some error before that call is made.

0 votesVote for this answer Mark as a Correct answer

Muhammad Kaleem answered on April 3, 2019 18:37

yes i have initialize it in controller, exception comes when my page is in unpublish condition

0 votesVote for this answer Mark as a Correct answer

Zach Perry answered on April 3, 2019 18:40

how are you retrieving the page to initialize it? Can you share your code?

0 votesVote for this answer Mark as a Correct answer

Muhammad Kaleem answered on April 3, 2019 18:43 (last edited on April 3, 2019 18:44)

i initialize page builder in my controler action before return the view, when i unpublish the page then id of that page becomes null thats why i'm facing this problem have you any fix for that please?

0 votesVote for this answer Mark as a Correct answer

Zach Perry answered on April 3, 2019 18:45

i asked to see how you are retrieving the page so i can determine why it is returning null.

0 votesVote for this answer Mark as a Correct answer

Muhammad Kaleem answered on April 3, 2019 18:48 (last edited on April 3, 2019 18:50)

here is my code

int currentPageId = 0; PressRelease currentPage = PressReleaseProvider.GetPressRelease("/press-releases/" + pageAlias, "en-US", SiteContext.CurrentSiteName); if (currentPage.GetValue("DocumentId") != null && currentPage.GetValue("DocumentId").ToString() != "") {int.TryParse(currentPage.GetValue("DocumentId").ToString(), out currentPageId);} if (currentPageId > 0) { HttpContext.Kentico().PageBuilder().Initialize(currentPageId);}

0 votesVote for this answer Mark as a Correct answer

Zach Perry answered on April 3, 2019 18:55

Does that error happen when trying to visit the page thru the MVC site, or only thru the CMS interface?

It doesn't look like you checking for published, which you probably should be, but i don't see where it wouldn't find that page. I would log your page alias and sitename you are getting to see if anything is weird.

0 votesVote for this answer Mark as a Correct answer

Muhammad Kaleem answered on April 3, 2019 19:00

error come for both through mvc site and from CMS when i go to page tab to edit the contents of page builder as well, zach my main point is that i want to manage(edit or update) my pagebuilder contents (widgets) while workflow in applied on page in unpublish condition

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.