a!localVariables( local!rule:rule!KONE_Development_userinputsheet_Rule(), local!allRole:rule!KONE_Development_ROLE(), local!allLanguage:rule!KONE_Development_LANGUAGE(), local!allBranch:rule!KONE_Development_BRANCH(), local!allRegion:rule!KONE_Development_REGION(), local!noFiltersApplied: all(fn!isnull, {ri!userinputsheet.KONE_user_name}), local!searchValue, a!sectionLayout( label:"Update Info", contents: { a!columnsLayout( columns: { a!columnLayout( contents: { a!textField( label: "Username", value: local!searchValue, saveInto: {local!searchValue }, refreshAfter: "KEYPRESS" ), a!buttonLayout( primaryButtons: { a!buttonWidget( label: "SEARCH", saveInto: { local!searchValue, }, disabled: local!noFiltersApplied ) } ), a!gridLayout( label: "Editable Grid", labelPosition: "ABOVE", headerCells: { a!gridLayoutHeaderCell( label: "Username" ), a!gridLayoutHeaderCell( label: "First Name" ), a!gridLayoutHeaderCell( label: "Last Name" ), a!gridLayoutHeaderCell( label: "Email" ), a!gridLayoutHeaderCell( label: "Role" ), a!gridLayoutHeaderCell( label: "Branch" ), a!gridLayoutHeaderCell( label: "Region" ), a!gridLayoutHeaderCell( label: "Manager_role" ), a!gridLayoutHeaderCell( label: "Language" ), a!gridLayoutHeaderCell( label: "CE_LEVEL" ), a!gridLayoutHeaderCell( label: "Telephone Number" ), a!gridLayoutHeaderCell( label: "Exceptional Case Library View Right" ), a!gridLayoutHeaderCell( label: "Update" ), a!gridLayoutHeaderCell( label: "Delete" ), a!gridLayoutHeaderCell( label: "Restart" ) }, columnConfigs: { a!gridLayoutColumnConfig( width: "DISTRIBUTE" ), a!gridLayoutColumnConfig( width: "DISTRIBUTE" ), a!gridLayoutColumnConfig( width: "DISTRIBUTE" ), a!gridLayoutColumnConfig( width: "DISTRIBUTE" ), a!gridLayoutColumnConfig( width: "DISTRIBUTE" ), a!gridLayoutColumnConfig( width: "DISTRIBUTE" ), a!gridLayoutColumnConfig( width: "DISTRIBUTE" ), a!gridLayoutColumnConfig( width: "DISTRIBUTE" ), a!gridLayoutColumnConfig( width: "DISTRIBUTE" ), a!gridLayoutColumnConfig( width: "DISTRIBUTE" ), a!gridLayoutColumnConfig( width: "DISTRIBUTE" ), a!gridLayoutColumnConfig( width: "DISTRIBUTE" ), a!gridLayoutColumnConfig( width: "DISTRIBUTE" ), a!gridLayoutColumnConfig( width: "DISTRIBUTE" ), a!gridLayoutColumnConfig( width: "DISTRIBUTE" ) }, rows: { a!forEach( items: local!rule, expression:a!gridRowLayout( contents: { a!textField( label: "Username", labelPosition: "ABOVE", value:if(local!searchValue=fv!item.KONE_user_name,local!searchValue,fv!item.KONE_user_name), saveInto: { fv!item.KONE_user_name, a!save(target:ri!userinputsheet.KONE_user_name,value:save!value), a!save(target:ri!userrole.NAME,value:save!value), a!save(target:ri!userrole.USER_ID,value:a!localVariables(local!value:fv!item.KONE_user_name, a!forEach( items:rule!KONE_Development_Username_UserId(), expression: if(local!value=fv!item.username,fv!item.userid,{}), ), )), }, refreshAfter: "UNFOCUS", readOnly: true, validations: {} ), a!textField( label: "First Name", labelPosition: "ABOVE", value:fv!item.FIRST_NAME, saveInto: {fv!item.FIRST_NAME, a!save(target:ri!userinputsheet.FIRST_NAME,value:save!value)}, refreshAfter: "UNFOCUS", validations: {} ), a!textField( label: "Last Name", labelPosition: "ABOVE", value:fv!item.LAST_NAME, saveInto: {fv!item.FIRST_NAME, a!save(target:ri!userinputsheet.LAST_NAME,value:save!value), }, refreshAfter: "UNFOCUS", validations: {} ), a!textField( label: "Email", labelPosition: "ABOVE", value:fv!item.Email, saveInto: { fv!item.Email, a!save(target:ri!userinputsheet.Email, value:save!value), a!save(target:ri!userrole.EMAIL,value:save!value)}, refreshAfter: "UNFOCUS", validations: {} ), a!dropdownField( label: "Role", labelPosition: "ABOVE", choiceLabels:reject(fn!isnull,local!allRole), choiceValues:reject(fn!isnull,local!allRole), value:if(isnull(fv!item.Role),"null",fv!item.Role), saveInto:{ fv!item.Role, 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.ROLE, value: save!value), 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,{}) )) }, validations: {} ), a!dropdownField( label: "Branch", labelPosition: "ABOVE", choiceLabels:reject(fn!isnull,local!allBranch), choiceValues:reject(fn!isnull,local!allBranch), value:if(isnull(fv!item.Branch),"null",fv!item.Branch), saveInto:{ fv!item.Branch, 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,{}) )) }, refreshAfter: "UNFOCUS", validations: {} ), a!dropdownField( label: "Region", labelPosition: "ABOVE", choiceLabels:reject(fn!isnull,local!allRegion), choiceValues:reject(fn!isnull,local!allRegion), value:fv!item.Region, saveInto:{ fv!item.Region, 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,{}) )) }, refreshAfter: "UNFOCUS", validations: {} ), a!dropdownField( label: "Manager_role", labelPosition: "ABOVE", choiceLabels:reject(fn!isnull,local!allRole), choiceValues:reject(fn!isnull,local!allRole), value:if(isnull(fv!item.Manager_role),"null",fv!item.Manager_role), saveInto:{ fv!item.Manager_role, a!save(target:ri!userinputsheet.Manager_role,value:save!value) }, refreshAfter: "UNFOCUS", validations: {} ), a!dropdownField( label: "Language", labelPosition: "ABOVE", choiceLabels:reject(fn!isnull,local!allLanguage), choiceValues:reject(fn!isnull,local!allLanguage), value:if(isnull(ri!userinputsheet.Language),"null",ri!userinputsheet.Language), saveInto:{ fv!item.Language, a!save(target:ri!userinputsheet.Language,value:save!value), a!save(target:ri!userrole.LANG_ID, value:a!forEach (items:rule!KONE_Development_Language_LanguageId(), expression:if(fv!item.Language=ri!userinputsheet.Language,fv!item.Language_Id,{}) )) }, refreshAfter: "UNFOCUS", validations: {} ), a!textField( label: "CE_LEVEL", labelPosition: "ABOVE", value:fv!item.CE_LEVEL, saveInto: { fv!item.CE_LEVEL, a!save(target:ri!userinputsheet.CE_LEVEL,value:save!value), a!save(target:ri!userrole.LEVEL,value:save!value) }, refreshAfter: "UNFOCUS", validations: {} ), a!textField( label: "Telephone Number", labelPosition: "ABOVE", value:fv!item.Telephone_number, saveInto: { fv!item.Telephone_number, a!save(target:ri!userinputsheet.Telephone_number,value:save!value), a!save(target:ri!userrole.TELEPHONE_NUMBER,value:save!value) }, refreshAfter: "UNFOCUS", validations: {} ), a!textField( label: "Exceptional Case Library View Right", labelPosition: "ABOVE", value:fv!item.Exceptional_case_library_view_right, saveInto: { fv!item.Exceptional_case_library_view_right, a!save(target:ri!userinputsheet.Exceptional_case_library_view_right,value:save!value), a!save(target:ri!userrole.IS_EXCEPTION,value:0), a!save(target:ri!userrole.ACTIVE,value:1), a!save(target:ri!userinputsheet.updateTime,value:now()), }, refreshAfter: "UNFOCUS", validations: {} ), a!richTextDisplayField( label:"Update", labelPosition:"ABOVE", value:{ a!richTextIcon( icon:"check", link:a!dynamicLink( 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) } ), } ), linkStyle:"STANDALONE", color:"POSITIVE" ) } ), a!richTextDisplayField( label:"Delete", labelPosition:"ABOVE", value:{ a!richTextIcon( icon:"arrow-down", link:a!dynamicLink( saveInto:{a!save(target:ri!userrole.ACTIVE,value:0), 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) }, ), } ), linkStyle:"STANDALONE", color:"NEGATIVE" ) } ), a!richTextDisplayField( label:"Restart", labelPosition:"ABOVE", value:{ a!richTextIcon( icon:"arrow-up", link:a!dynamicLink( saveInto:{a!save(target:ri!userrole.ACTIVE,value:1), 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) }, ), } ), linkStyle:"STANDALONE", color:"POSITIVE", ) } ), } ) ) }, ), } ) } ) } ) )
Sorry i pose this problem again, this time the situation is a little bit different, i wish to update it. The primary key as ri!userinputsheet.USER_ID, another unique column as ri!userinputsheet.username. I a!writeToDataEntity again, then it got error report, Theoretically I write into with primary key and username is not change because it is read only, it should have achieve update function already, then how it can't be ?
Discussion posts and replies are publicly visible
Did you have a look at tomcat-stdout.log to see more details about why the Insert failed? It will probably have a more descriptive message there.
how to check tomcat log? as what you said
[your-environments-url]/suite/logs
i figure out already, it is the duplicate entry column for 'username'. The actually reason is i could't find a way match the username with the primary key userid, since this, it can't update into database