web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Occasional scripting e...
Power Apps
Suggested Answer

Occasional scripting error when opening records

(2) ShareShare
ReportReport
Posted on by 4

Hi everyone,

occasionally i get a scripting error when opening a record. the error is shown in the picture below.

 

scripting_error.png

 

The error states, that the getValue()-Function cannot be called because the object is null.

I get the column-control with formContext.getControl('columnname') and check if the returning object exists. Afterwards i call getAttribute().getValue() on the control and the error above appears sometimes. Keyword here is sometimes. Often enough if i reload the record the error doenst show up a second time.

 

Has anyone experienced a similiar behavior? I appreciate every input i can get on this 🙂

 

I pasted the code snippet below so you can better understand whats going on.

 

 

 my.AbgleichStandortMitPreislistenartikelStandort = function (executionContext) {
 var formContext = executionContext.getFormContext();
 var standortCtrl = formContext.getControl('syn_standort_id');
 var preislistenartikelCtrl = formContext.getControl('syn_preislistenartikeln_id');

 if (!preislistenartikelCtrl || !standortCtrl) { return; }

 var standort = standortCtrl.getAttribute().getValue();
 var preislistenArtikel = preislistenartikelCtrl.getAttribute().getValue();

 ...
 }

 

 

I have the same question (0)
  • Suggested answer
    RMSRothmayer Profile Picture
    36 on at
    Hi,
    have you added any more debug messages and analyzed the results?
     
    e.g.
     
    if (!pricelistarticleCtrl || !locationCtrl) { return; }
     
    console.log(“DEBUG”);
    console.log(pricelistarticleCtrl);
    console.log(locationCtrl);
     
     var location = locationCtrl.getAttribute().getValue();
     var preislistenArtikel = preislistenartikelCtrl.getAttribute().getValue();
     ...
     }
     
    Are the two fields possibly 1:n relationships? In this case, the argument for retrieving the value can change, e.g. to “_syn_pricelistarticle_id_value”. It is best to simply output all values.
     
    console.log(formContext.getControl());
     
    Hope this input helps you to find the error.
     
  • Jonathan Manrique Profile Picture
    2,695 on at
    Hi 
     
    What you should do is add a precondition before the getvalue, which allows you to determine if it is null or not, if it is null it does nothing and if it is not null you get the value
     
    if(standortCtrl.getAttribute().getValue()===nul){acion}
     
  • ankit_singhal Profile Picture
    618 Moderator on at
    you can put the condition and check null.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the April Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
Vish WR Profile Picture

Vish WR 1,045

#2
Valantis Profile Picture

Valantis 675

#3
11manish Profile Picture

11manish 592

Last 30 days Overall leaderboard