I need to access the value of a field that is in a detail table for a conditional script. The field exists but i get an “unknown field” in the script editor. I have copied the script below. I am sure it just can’t find the field but I cannot figure out the correct statement to use. I have tried record.field, record.detail, etc.
The condition relies on two values so I am using a switch statement.
switch (itemCheck){
case “1” :
if (record.fields[“kostenart_id”] == “1048”) {
text = “varText1”;
}
else if (record.fields[“kostenart_id”] !=“1048”){
text = “varText2”;
}
break;
When you are typing text, reselect some text (any) then click on the icon that look like a chain pieces. On the target tab select same window(_self). On the third tab, select your Template and click the send to server.
The name of the field in your dialog box might differ from what I wrote before since mine is in french and I’m trying to translate.
Ok. Thanks! I made some progress but it does not appear to be quite right. On set seems to work but the other does not. All of the variable tables and text are at the bottom of the scripts pane.
The help from you and hamelj combined with my stubborn attitude resulted in success!
Here is the syntax that finally worked just in case it helps someone in a similar situation. Note that one of the keys was that ‘table’ had to be plural - record.tables
switch (itemCheck){
case “1” :
if (record.tables[“detail”][0].fields[“kostenart_id”] == “1048”) {
text = “varText1”;
}
else{
text = ‘varText2’;
}
break;