Get property js

Former Member
Former Member
Hi i want to get value of field , the code is var innovator = new Innovator(); var partItem = innovator.newItem(“t4result”,”get”); var a =partItem.getproperty(“t4id”); console.log(a); ——————- the result is undefined, what is the problem ?
Parents
  • Hello, Using innovator.newItem will create a new query-able item, but will not return any data by itself. The AML created behind the scenes for the line var partItem = innovator.newItem("t4result","get"); looks like the query below.
    <AML>
    <Item type="t4result" action="get"/>
    </AML>
    In order to run this query and get data, you would need to use partItem.apply();; however, without passing in any additional parameters, this query will get all of the t4result items instead of just the one you are editing. Additionally, running an item query like this will get the current state of the item from the server, but will not contain any field data unless you have already saved the item. In order to get the value entered in a field, you can use the sample code below. var val = getFieldByName("t4id").getElementsByTagName("input")[0].value; Chris
    Christopher Gillis Aras Labs Software Engineer
Reply
  • Hello, Using innovator.newItem will create a new query-able item, but will not return any data by itself. The AML created behind the scenes for the line var partItem = innovator.newItem("t4result","get"); looks like the query below.
    <AML>
    <Item type="t4result" action="get"/>
    </AML>
    In order to run this query and get data, you would need to use partItem.apply();; however, without passing in any additional parameters, this query will get all of the t4result items instead of just the one you are editing. Additionally, running an item query like this will get the current state of the item from the server, but will not contain any field data unless you have already saved the item. In order to get the value entered in a field, you can use the sample code below. var val = getFieldByName("t4id").getElementsByTagName("input")[0].value; Chris
    Christopher Gillis Aras Labs Software Engineer
Children
No Data