Alpha : open dialog in alpha using custom code

@Paul_Thomas @gaurav.pandey @Simphiwe
const pages = await ap.pages.get();
console.log(pages)
const newPage = pages.find((el)=> el.name == ‘Page name’);
ap.dialog.open({
page: newPage,
height:‘50’,
width: ‘50’,
header: ‘Title’
})

I’m not able to locate or access the openDialog method when trying to invoke it from custom code.
Could you please share the correct import statement or usage pattern for this method within the alpha ?

I tried with pages and pages.pagelist but both gives me an empty array

Hi @shubham.dhamne,

You can use ap.pages.getGLobalPages() to get global pages.
The page you are opening as a dialog should be a global page.
I have added an example of a clear snippet code below, provided that the page you will be opening as dialog is “Appointment Form - Dialog“.

const pages = await ap.pages.getGLobalPages();

if (params.eventDetail.value == ‘bookAppointment’) {
const newPage = pages.find((el) => el.name == 'Appointment Form - Dialog'); 

ap.dialog.open({ page: newPage, height: '100', width: '70', header: 'New Appointment' })
}

2 Likes

@Simphiwe there is no object as getGLobalPages, in pages

@shubham.dhamne what version of alpha are you using?And did you add the page as a global page?

I’m not sure about version of alpha, but its Training Tenant of alpha, and Yes this are the global pages.

@shubham.dhamne

When you use await ap.pages.getGLobalPages(), you supposed to get all your global pages.
Can you share your project name on the chat??

Hi @shubham.dhamne,

It seems like the await ap.pages.getGLobalPages(), the L after g on GLobalPages is not required to be capitalized anymore.
Here is the updated code below for getting global pages.

const pages = await ap.pages.getGlobalPages();

1 Like