Question

Check value on page

Hi;

I check value of field (attribute) on page in onRender method

sometime it work correctly and sometime it show error that this.get("usrStatus") is undifined

here is my code,

            onRender: function() {

                var that = this;

                setTimeout(function() {

                    if (that.get("UsrStatus").value === "22a42a46-1f02-46d4-8a1b-e947631a0671") {

                        that.set("justClosed", true);

                        that.sandbox.publish("UnblockManClosed");

                    }

                });

                this.callParent(arguments);

            }

 

Regards

Tomek

Like 0

Like

4 comments

Try putting the code in onEntityInitialized instead of onRender. With your setTimeout it likely sometimes gets the timing right that the entity is available and other times not. If you put the code in onEntityInitialized the object values will definitely be available.

Ryan Farley,

Thank Ryan;

That may sold muy problem

Maybe have you anny idea when this is on Preconfigured page not base on any entity?

 

Regards

Tomek

Hello Tomasz,

I'm not completely sure, but it looks like it would work the same on a preconfigured page. Looking at PreconfiguredPageV2 it does also define onEntityInitialized. PreconfiguredPage also does inherit BasePageV2 (which inherits BaseEntityPage), so I would assume it would work the same for the preconfigured page.

Ryan

Dear Tomasz,

As advised above by Ryan, please transfer your code to basic onEntityInitialized method. At the moment of its execution page model is already retrieved. onEntityInitialized method is present on PreconfiguredPageV2, since it inherits from BasePageV2, which has the method realization.

If you will have any further questions, please let us know.

Regards,

Anastasia

Show all comments