I'm using CS (10.5)
I created a module where you can create a node filling his categories attributes with a form values, I also made the form. I have attributes of every types, even custom types created by others. All of them works good and save the value from the form. But only the attribute with type Text: Popup is not working.
The attribute has 2 valid values and initialy it's settled an <none>, because it's not mandatory.
The form is a javascript + html form which looks like the CS creation wizard. The user fill the attributes values and click a button, then it will send all the info to my oscript module. This is the function that recover the values and fill the categories with those values:
function Dynamic CargarValoresAtributos(Object result, Object prgCtx, Record request)
.fRequest = request
Dynamic attrDataDef = result.attrData.fDefinitions
Dynamic attrDataValues = result.attrData.fData
Dynamic catDef
Integer categoryCounter = 0
//Iteración por categoría
for catDef in attrDataDef
categoryCounter = categoryCounter + 1
Integer catID= Assoc.Keys(attrDataDef)[categoryCounter][1]
//A partir de aquí
Dynamic attribute
for attribute in catDef.Children
Assoc attrCode
if(attribute.Type == $AttrTypeSet)
//Tenemos un SET
Dynamic setItem
Integer currentSetRow = 1
boolean puedeHaberValorSet = true
while((currentSetRow <= attribute.MaxRows) && puedeHaberValorSet)
puedeHaberValorSet = false
boolean newLineReady = false
//Hay que montar una nueva línea de SET según el patrón de atributos que contiene
//Para ello, se hará lo siguiente:
Assoc childDefAssoc
Object llAttr
Object llAttributeSubsystem = $LLIApi.LLAttributeSubsystem
Dynamic newChildLine = Assoc.CreateAssoc()
if (currentSetRow > 1)
Assoc newChildItem
for childDefAssoc in attribute.Children
llAttr = llAttributeSubsystem.GetItem( childDefAssoc.Type )
newChildItem = llAttr.DataNew( prgCtx, childDefAssoc )
if !newChildItem.OK
break
else
newChildLine.( childDefAssoc.ID ) = newChildItem.DataAssoc
end
end
newLineReady = true
end
//Fin de la creación de la línea
for setItem in attribute.Children
//Vamos a recorrer el SET para ver todos los elementos
Integer currentSetAttrRow = 1
boolean puedeHaberValorSetAttr = true
while ((currentSetAttrRow <= setItem.MaxRows) && puedeHaberValorSetAttr)
//attrCode para un tipo noSET - iteramos
attrCode = ESTEVEFORMS::esteveFormsUtils::Utils.GetFullAttrInfo(.fRequest, catID, attribute.Type, attribute.ID, currentSetRow, setItem.Type, setItem.ID, currentSetAttrRow)
if (attrCode.attrValue == "")
puedeHaberValorSetAttr = false
else
puedeHaberValorSet = true
if(newLineReady)
attrDataValues[categoryCounter].Values[1].(attribute.ID).Values[currentSetRow] = newChildLine
newLineReady = false
end
if(setItem.Type == $AttrTypeBoolean || setItem.Type == $AttrTypeUser || setItem.Type == $AttrTypeUserPopup)
attrDataValues[categoryCounter].Values[1].(attribute.ID).Values[currentSetRow].(setItem.ID).Values[currentSetAttrRow] = Str.StringToValue(attrCode.attrValue)
elseif(setItem.Type == $AttrTypeDate || setItem.Type == $AttrTypeDatePopup || setItem.Type == $AttrTypeLLAttrCalendarAttr)
Date myDate = Date.StringToDate( attrCode.attrValue, "D/%Y/%m/%d")
attrDataValues[categoryCounter].Values[1].(attribute.ID).Values[currentSetRow].(setItem.ID).Values[currentSetAttrRow] = myDate
else
attrDataValues[categoryCounter].Values[1].(attribute.ID).Values[currentSetRow].(setItem.ID).Values[currentSetAttrRow] = attrCode.attrValue
end
end
currentSetAttrRow=currentSetAttrRow+1
end
end
currentSetRow = currentSetRow+1
end
else
Integer currentRow = 1
boolean puedeHaberValor = true
while ((currentRow <= attribute.MaxRows) && puedeHaberValor)
//attrCode para un tipo noSET
attrCode = ESTEVEFORMS::esteveFormsUtils::Utils.GetFullAttrInfo(.fRequest, catID, attribute.Type, attribute.ID, currentRow, undefined, undefined, undefined)
if (attrCode.attrValue == "")
puedeHaberValor = false
else
attrDataValues[categoryCounter].Values[1].(attribute.ID).Values[currentRow] = attrCode.attrValue
end
currentRow=currentRow+1
end
end
if(attribute.NumRows == attribute.MaxRows)
//Hace falta chequeo de si es multilinea
end
end
end
Dynamic attrData = result.attrData
attrData.fData = attrDataValues
attrData.fDefinitions = attrDataDef
return attrData
end
I've checked that and I'm sure the value of the attribute Status of the Deed has been saved correctly. However when I go to the objet and check the categories the value has not been saved or showed.
I have plenty of attributes and this is the only one his giving my that issue. Any ideas about what could be the problem? If I modify the value manually after the object has been create and save it, it works. But never work saving it in oscript with the value from the form. All ideas are welcome. If you need more info to understand the problem, I'll provide more info.
Thank in advance.