a!localVariables( local!allRole:rule!KONE_Development_ROLE(), local!allLanguage:rule!KONE_Development_LANGUAGE(), local!allBranch:rule!KONE_Development_BRANCH(), local!allRegion:rule!KONE_Development_REGION(), a!formLayout( contents: { a!textField( label: "Username", value: {ri!userinputsheet.kone_user_name}, saveInto: { a!save(target:ri!userinputsheet.kone_user_name, value:save!value), a!save(target:ri!userrole.NAME, value:save!value), }, required: true ), a!textField( label: "firstName", value: {ri!userinputsheet.FIRST_NAME}, saveInto: {ri!userinputsheet.FIRST_NAME}, required: true ), a!textField( label: "LastName", value: {ri!userinputsheet.LAST_NAME}, saveInto: {ri!userinputsheet.LAST_NAME}, required: true ), a!textField( label: "Email", value: {ri!userinputsheet.Email}, saveInto: { a!save(target:ri!userinputsheet.Email, value:save!value), a!save(target:ri!userrole.EMAIL,value:save!value), }, required: true ), a!dropdownField( label:"Role", placeholder:"---please fill your Role---", choiceLabels:reject(fn!isnull,local!allRole), choiceValues:reject(fn!isnull,local!allRole), value:ri!userinputsheet.Role, saveInto:{ a!save(target:ri!userinputsheet.Role,value:save!value), a!save( target:ri!userrole.ROLE_ID, value: a!forEach (items:rule!KONE_Development_Role_RoleId(), expression:if(fv!item.Role=ri!userinputsheet.Role,fv!item.Role_Id,{}) )), a!save(target:ri!userrole.PHASE_ID, value:a!forEach (items:rule!KONE_Development_Role_RoleId(), expression:if(fv!item.Role=ri!userinputsheet.Role,fv!item.Role_Id,{}) )) }, required:true ), a!dropdownField( label:"Branch", placeholder:"---please fill your Branch---", choiceLabels:reject(fn!isnull,local!allBranch), choiceValues:reject(fn!isnull,local!allBranch), value:ri!userinputsheet.Branch, saveInto:{ a!save(target:ri!userinputsheet.Branch,value:save!value), a!save(target:ri!userrole.BRANCH,value:save!value), a!save(target:ri!userrole.BRANCH_ID, value:a!forEach (items:rule!KONE_Development_Branch_BranchId(), expression:if(fv!item.Branch=ri!userinputsheet.Branch,fv!item.Branch_Id,{}) )) }, required:true ), a!dropdownField( label:"Region", placeholder:"---please fill your Region---", choiceLabels:reject(fn!isnull,local!allRegion), choiceValues:reject(fn!isnull,local!allRegion), value:ri!userinputsheet.Region, saveInto:{ a!save(target:ri!userinputsheet.Region,value:save!value), a!save(target:ri!userrole.REGION,value:save!value), a!save(target:ri!userrole.REGION_ID, value:a!forEach (items:rule!KONE_Development_Region_RegionId(), expression:if(fv!item.Region=ri!userinputsheet.Region,fv!item.Region_Id,{}) )) }, required:true ), a!dropdownField( label:"Manager_Role", placeholder:"---please fill your Role---", choiceLabels:reject(fn!isnull,local!allRole), choiceValues:reject(fn!isnull,local!allRole), value:ri!userinputsheet.Manager_role, saveInto:{ a!save(target:ri!userinputsheet.Manager_role,value:save!value), }, required:true ), a!dropdownField( label:"Language", placeholder:"---please fill your Language---", choiceLabels:reject(fn!isnull,local!allLanguage), choiceValues:reject(fn!isnull,local!allLanguage), value:ri!userinputsheet.Language, saveInto:{ a!save(target:ri!userinputsheet.Language,value:save!value), a!save(target:ri!userrole.LANGUAGE_ID, value:a!forEach (items:rule!KONE_Development_Language_LanguageId(), expression:if(fv!item.Language=ri!userinputsheet.Language,fv!item.Language_Id,{}) )) }, required:true ), a!textField( label: "CELevel", value: {ri!userinputsheet.CE_LEVEL}, saveInto: { a!save(target:ri!userinputsheet.CE_LEVEL,value:save!value), a!save(target:ri!userrole.LEVEL,value:save!value) }, required: true ), a!textField( label: "Telephone Number", value: {ri!userinputsheet.Telephone_number}, saveInto: { a!save(target:ri!userinputsheet.Telephone_number,value:save!value), a!save(target:ri!userrole.TELEPHONE_NUMBER,value:save!value) }, required: true ), a!textField( label: "Exceptional Case Library View Right", value: {ri!userinputsheet.Exceptional_case_library_view_right}, saveInto: { a!save(target:ri!userinputsheet.Exceptional_case_library_view_right,value:save!value), a!save(target:ri!userrole.IS_EXCEPTION,value:save!value), }, required: true ) }, buttons: a!buttonLayout( primaryButtons: { a!buttonWidget( label: "Submit", saveInto:( a!writeToDataStoreEntity( dataStoreEntity: {cons!KONE_Development_userrole_Constant,cons!KONE_Development_userinputsheet_Constant}, valueToStore:{ri!userrole,ri!userinputsheet} ), ), submit: true, style: "PRIMARY" ) } ) ) )
error is: Interface Definition: Expression evaluation error: An error occurred while executing a smart service: An error occurred while trying to write to the entity "KONE_Development_userrole" [id=8a2e408a-8d63-40b5-8b0b-ac820966b9ea@16406, type=USER_ROLE (id=3178)] (data store: KONE_User_Development_Database). Details: org.hibernate.exception.ConstraintViolationException: could not insert: [USERROLEDT2804]: java.sql.SQLIntegrityConstraintViolationException: (conn=65245) Column 'ACTIVE' cannot be null: org.mariadb.jdbc.internal.util.exceptions.MariaDbSqlException: Column 'ACTIVE' cannot be null: java.sql.SQLException: Column 'ACTIVE' cannot be null Data: TypedValue[it=3179,v={{<null>,immortalvirgil,luzhe.wang@accenture.com,,131,131,CNZZ,SO,,,,,41,6,<null>,<null>,<null>,<null>,,,<null>,6,8613478478682,0,},{<null>,,luzhe.wang@accenture.com,HQ CSE Manager,<null>,<null>,CNZZ,SO,,,,HQ SC CSE Engineer,<null>,<null>,<null>,<null>,<null>,<null>,,,<null>,<null>,8613478478682,<null>,}}]
how can i make the active column can be null? Thank you so much
Discussion posts and replies are publicly visible
Can you share your CDT?
<xsd:element name="test" nillable="true" type="xsd:boolean" /> ALso check if the XSD value is nullable set to true
What is the type of the field?
I just set a default value would be fine, by the way, do you have sample code for a!writeDataStoreEntity(), that i click one button but can save into two table at same time?
a!buttonWidget( label: "Submit", submit: true, saveInto: a!writeToMultipleDataStoreEntities( valuesToStore: { a!entityData(entity: entity1, data: ri!Variable1), a!entityData(entity: entity2, data: ri!Variable2) } ), style: "PRIMARY" )
contains entities from different data stores
Yes it can
nterface Definition: Expression evaluation error: An error occurred while executing a smart service: The list of EntityData passed to the smart service contains entities from different data stores. All entities must belong to the same data store. No values have been written. (APNX-1-4208-001)
buttons: a!buttonLayout( primaryButtons: { a!buttonWidget( label: "Submit", saveInto: a!writeToMultipleDataStoreEntities( valuesToStore: { a!entityData(entity: cons!KONE_Development_userinputsheet_Constant, data: ri!userinputsheet), a!entityData(entity: cons!KONE_Development_userrole_Constant, data: ri!userrole) } ), submit: true, style: "PRIMARY" ) } )
use can use multiple a!writetoDataStoreEntities(). one for each datastore
what do you mean?
You have two data stores right- one is having entity corresponding to KONE_Development_userinputsheet_Constant and other will be having entity for KONE_Development_userrole_Constant.
If you move of the entity form data store A to B so that both the entities are within same data store, then your code will work fine.
What do you mean? Switch order?
Do you know how to refresh text to be blank after click any buttons?