Important Update: Community URLs redirect issues are partially resolved. Learn More. .

cancel
Showing results for 
Search instead for 
Did you mean: 

Error "SCRIPT5007" when changing a Value list

DavidRego
Contributor II

Greetings,

 

I'm having a problem with a custom object to change the value of a Value list on Archer 6.4 sp1. Whenever I try to change the value, it changes but provokes an "SCRIPT5007: Unable to get property 'ReadOnly' of undefined or null reference" error also.

 

I'm using the following code:

<script type="text/javascript">
Sys.Application.add_load(function() {
   var globalValueList01 = 22534;
   updateValueList(globalValueList01, "72409");
   function updateValueList(changeId, assignedValue) {
      var valueArray = new Array(1);
      valueArray[0] = assignedValue;
      / / ArcherTech.UI.GenericContent.GetInstance().setFieldValue(changeId, valueArray, '');
      $CM.setFieldValue(changeId, valueArray, '');
   }
});
</script>

 

I've tried using the ArcherTech.UI.GenericContent.GetInstance().setFieldValue method instead, but it causes the same error.

 

Could you give some advice in what could be happening?

 

Thanks!

6 REPLIES 6

jsol5
Advocate II

Syntax appears right.

I am noticing that the values list ID doesn't have quotes but the field id does. 

I think, in the examples I have, both values are in quotes.

 

Lastly, make sure your field ID's are right.

Thanks for your answer! 

I've tried both values in quoutes and both with not quotes and the error still persist. 

Is the values list item "available" to the user logged in?

Is the field visible?

Are the field ID and values list ID correct?

 

This message:Unable to get property 'ReadOnly' of undefined or null reference" 

IMO, it means that it can't find the field or value.  

The field is visible and the field value is changing correctly to the Value List ID, ergo the Field Id and the Value List ID are correct and available. I've checked with all the possible values of the Value List and in all cases it changes the vl correctly, but it logs the  "SCRIPT5007: Unable to get property 'ReadOnly' of undefined or null reference" on the javascript console.

DavidRego
Contributor II

After some debugging, it seems that the problem is this constant: ArcherTech.Enums.LayoutItemActionType.ReadOnly. Archer javascript tries to access it on its internal method for setting the value, but it seems to not be defined. ArcherTech.Enums exists but ArcherTech.Enums.LayoutItemActionType it's not. Accessing the field .ReadOnly of a non-defined item causes the error. 

 

pastedImage_9.png

 

Any Ideas of how can I fix it?

 

Thanks!

As an aside - I know I've done this, but unfortunately, I'd have to dive into a working example where I've done this to see what's different.  At the moment, the code looks the same.  So, I feel like there's a configuration setting that's causing your issue.  

Is it possible there is a DDE making the field read only or is it private?

Can you run the script in the browser tools and get it to update successfully?

 

 

 

 

As just more info - I know this is for a user/list field, but in a related example I followed this article

https://community.rsa.com/thread/77420

 

Also... if you can't resolve, I have also updated the record vs. updating the field.  So, used API vs. Javascript/HTML