Why we should not hardcode pyWorkPage in activity or DT?

Why we should not hardcode pyWorkPage in activity or Data transform?

What happens if we use Top instead of pyWorkPage? I mean what is the benefit?

@ShashikiranK17312002

It depends on the context where the rule is running. It might happen that during runtime the rule might not be able to refer to pyWorkPage, or maybe the primary page is something different at that instant. Its always better to let the rule engine decide on the page context. You can refer to this link for more examples.

You can refer to this link for Top page context.

@ShashikiranK17312002 Hardcoding pyWorkPage in activities or data transforms ties the logic to a specific context, making it less reusable and prone to errors in scenarios where the primary page isn’t explicitly set as pyWorkPage (e.g., a process using Temp/user level page other than pyWorkPage or background processing). Using Primary/Top is more dynamic and ensures the logic references the primary work object of the current context, regardless of the page’s name.

Hi @ShashikiranK17312002,

Hardcoding pyWorkPage ties the process to a specific work page, making it difficult to change or extend the process in the future. If the structure of your work objects or processes changes, you will have to modify each instance where pyWorkPage is hardcoded.

it’s best practice to use dynamic references (like Top or PrimaryPage) instead of hardcoding the specific work page. This allows the process to be more adaptable and reusable in different contexts.

Thanks

Mohd Qizer Uddin