A short but useful article today – PXGraph is a center of the whole business logic in Acumatica framework and can be triggered from different places: UI, Web Services API, Mobile, Import and so on.
As a developer you sometimes need to know what is the context of the request you are processing right now, so you can adjust the business logic. For this purpose PXGraph has a set of flags that are automatically triggered during different operations. Here they are:
- graph.IsImport – flag will be automatically set when Import/Export engine is working. This will be true for Import/Export scenarios, Web Services, Copy/Paste action, Mobile. So almost all operations except user interface.
- graph.IsExport – flag is similar to previous one but is set only during export operations. Please note that during Export, IsImport flag is active too. So if you need
- Only Export ( graph.IsImport && graph.IsExport )
- Only Import ( graph.IsImport && !graph.IsExport )
- Both ( graph.IsImport )
- graph.IsMobile – flag is active only when request came from Acumatoca mobile application. Note that other flags like IsImport may be active too.
- graph.IsCopyPasteContext – flag is active during copying and pasting records. As copy/paste also works thought export/import engine, other flags may may be active too.
- graph.IsImportFromExcel – flag is active when user tries to upload records to grid from excel file.
There are 2 more flags that are not available for setting:
- graph.IsPageReload – Acumatica opens page in 2 steps: on the first one browser loads all HTML and Scripts; on the second one it loads the data. Due to this process, first request does not need to know anything about data, but need to load data schema (like is field a combobox or just text edit, selector and so on). This flag identifies initial request.
- graph.IsPageGeneratorRequest – it is very important to know exact page structure for import/export engine as some settings (like commit changes) are available only in the page. So to work properly, Acumatica framework collects page structure and cache it in the memory. Of course during page inspection graph must be involved as well. This flag identifies page inspection process. Read more about it in the article cannot automate this page.
Just as a reminder – all these flags are readonly and should not be set by you in any case.
Have a great development!