I using a record relationship (1 - Many) (Dept -- Employee (multiple)). I am trying to create a interface, where in top grab the Dept details and in bottom Employee details for that Department , which is Editable grid. When I try to addRowLink - its not creating a new row. Pls see the code below and let me know , what is the issue.
a!localVariables( local!emp : 'recordType!{f4411d12-5d9e-43b0-9eb3-430ef2ea01b9}Emp.fields.{a808753b-fbba-4fd9-bd49-058256eae7a2}empno' : "", local!empnme : 'recordType!{f4411d12-5d9e-43b0-9eb3-430ef2ea01b9}Emp.fields.{62b2206f-9897-4495-9957-8fc3c3a6253a}ename': "", local!job : 'recordType!{f4411d12-5d9e-43b0-9eb3-430ef2ea01b9}Emp.fields.{47784a4a-362f-4104-a42d-4762074fddec}job':"", local!sal : 'recordType!{f4411d12-5d9e-43b0-9eb3-430ef2ea01b9}Emp.fields.{2d76dd3c-1e76-4924-af64-24652c4f3b4f}sal':"", a!formLayout( label: "Department & Employee Relationship", contents: { a!sectionLayout( label: "Department", contents: { a!textField( label: "Department No", labelPosition: "ADJACENT", value: ri!Dept['recordType!{52f2ed75-d5b5-46ce-b6ec-43c3a900feb1}Department.fields.{cde21b2f-05db-4f33-ac0c-e062d24a1f17}deptno'], saveInto: {ri!Dept['recordType!{52f2ed75-d5b5-46ce-b6ec-43c3a900feb1}Department.fields.{cde21b2f-05db-4f33-ac0c-e062d24a1f17}deptno']}, refreshAfter: "UNFOCUS", validations: {} ), a!textField( label: "Department Name", labelPosition: "ADJACENT", value : ri!Dept['recordType!{52f2ed75-d5b5-46ce-b6ec-43c3a900feb1}Department.fields.{5f09405f-001c-41c3-bc2e-5524c0f97428}dname'], saveInto: {ri!Dept['recordType!{52f2ed75-d5b5-46ce-b6ec-43c3a900feb1}Department.fields.{5f09405f-001c-41c3-bc2e-5524c0f97428}dname']}, refreshAfter: "UNFOCUS", validations: {} ), a!sectionLayout( label: "Employee Details", contents: { a!gridLayout( label: "", labelPosition: "ABOVE", headerCells: { a!gridLayoutHeaderCell(label: "Employee Number"), a!gridLayoutHeaderCell(label: "Employee Name"), a!gridLayoutHeaderCell(label: "Job"), a!gridLayoutHeaderCell(label: "Salary") }, columnConfigs: {}, rows: { a!forEach( items : ri!Dept['recordType!{52f2ed75-d5b5-46ce-b6ec-43c3a900feb1}Department.relationships.{71959808-8139-4958-b7aa-0ad4bdc3b517}DeptToEmployee'], expression: a!gridRowLayout( contents: { a!textField( label : "Employee Number", value: fv!item['recordType!{f4411d12-5d9e-43b0-9eb3-430ef2ea01b9}Emp.fields.{a808753b-fbba-4fd9-bd49-058256eae7a2}empno'], saveInto: fv!item['recordType!{f4411d12-5d9e-43b0-9eb3-430ef2ea01b9}Emp.fields.{a808753b-fbba-4fd9-bd49-058256eae7a2}empno'] ), a!textField( label : "Employee Name", value: fv!item['recordType!{f4411d12-5d9e-43b0-9eb3-430ef2ea01b9}Emp.fields.{62b2206f-9897-4495-9957-8fc3c3a6253a}ename'], saveInto: fv!item['recordType!{f4411d12-5d9e-43b0-9eb3-430ef2ea01b9}Emp.fields.{62b2206f-9897-4495-9957-8fc3c3a6253a}ename'] ), a!textField( label : "Job", value: fv!item['recordType!{f4411d12-5d9e-43b0-9eb3-430ef2ea01b9}Emp.fields.{47784a4a-362f-4104-a42d-4762074fddec}job'], saveInto: fv!item['recordType!{f4411d12-5d9e-43b0-9eb3-430ef2ea01b9}Emp.fields.{47784a4a-362f-4104-a42d-4762074fddec}job'] ), a!textField( label : "Salary", value: fv!item['recordType!{f4411d12-5d9e-43b0-9eb3-430ef2ea01b9}Emp.fields.{2d76dd3c-1e76-4924-af64-24652c4f3b4f}sal'], saveInto: fv!item['recordType!{f4411d12-5d9e-43b0-9eb3-430ef2ea01b9}Emp.fields.{2d76dd3c-1e76-4924-af64-24652c4f3b4f}sal'] ) } ) ) }, addRowLink: a!dynamicLink( label : "Add Employee", saveInto: { a!save(ri!Emp,append('recordType!{f4411d12-5d9e-43b0-9eb3-430ef2ea01b9}Emp.fields.{a808753b-fbba-4fd9-bd49-058256eae7a2}empno',local!emp)), a!save(ri!Emp,append('recordType!{f4411d12-5d9e-43b0-9eb3-430ef2ea01b9}Emp.fields.{62b2206f-9897-4495-9957-8fc3c3a6253a}ename',local!empnme)), a!save(ri!Emp,append('recordType!{f4411d12-5d9e-43b0-9eb3-430ef2ea01b9}Emp.fields.{47784a4a-362f-4104-a42d-4762074fddec}job',local!job)), a!save(ri!Emp,append('recordType!{f4411d12-5d9e-43b0-9eb3-430ef2ea01b9}Emp.fields.{2d76dd3c-1e76-4924-af64-24652c4f3b4f}sal',local!sal)),} ), selectionSaveInto: {}, validations: {}, rowHeader: 1, shadeAlternateRows: true ) } ) } ) }, buttons: a!buttonLayout( primaryButtons: { a!buttonWidget( label: "Submit", submit: true, style: "PRIMARY", loadingIndicator: true ) }, secondaryButtons: { a!buttonWidget( label: "Cancel", value: true, saveInto: {}, submit: true, style: "NORMAL", validate: false ) } )))
Discussion posts and replies are publicly visible
Hi saravanang0001,you can take reference from this code, In this I just replaced your record with mine having 1-many relations to add a new row.hope it will help youthankyou
a!localVariables( a!formLayout( label: "Department & Employee Relationship", contents: { a!sectionLayout( label: "Department", contents: { a!textField( label: "EMail", labelPosition: "ADJACENT", value: ri!userDetails['recordType!{d8d2946d-462b-404a-ba5e-d96036a0edc1}UA User Detail.fields.{7a392978-7d23-4f26-b793-21b77b8dcd7a}Email'], saveInto: ri!userDetails['recordType!{d8d2946d-462b-404a-ba5e-d96036a0edc1}UA User Detail.fields.{7a392978-7d23-4f26-b793-21b77b8dcd7a}Email'], refreshAfter: "UNFOCUS", validations: {} ), a!textField( label: "userId", labelPosition: "ADJACENT", value :ri!userDetails['recordType!{d8d2946d-462b-404a-ba5e-d96036a0edc1}UA User Detail.fields.{9a3cb925-d459-4387-8650-c358cd83c200}userIdPk'], saveInto: ri!userDetails['recordType!{d8d2946d-462b-404a-ba5e-d96036a0edc1}UA User Detail.fields.{9a3cb925-d459-4387-8650-c358cd83c200}userIdPk'], refreshAfter: "UNFOCUS", validations: {} ), a!sectionLayout( label: "Employee Details", contents: { a!gridLayout( label: "", labelPosition: "ABOVE", headerCells: { a!gridLayoutHeaderCell(label: "Employee Number"), a!gridLayoutHeaderCell(label: "Employee Name"), }, columnConfigs: {}, rows: { a!forEach( items : ri!userDetails['recordType!{d8d2946d-462b-404a-ba5e-d96036a0edc1}UA User Detail.relationships.{da25471d-3af8-4d3a-8a55-262c411d41d6}uaEmailAuthentication'], expression: a!gridRowLayout( contents: { a!textField( label : "emailAuthenticationId", value: fv!item['recordType!{d0cb3fc5-719f-4354-a800-13932d8ce546}UA Email Authentication.fields.{1b8832e2-14cb-4072-834d-55961f1348ad}EmailAuthenticationidPk'], saveInto: fv!item['recordType!{d0cb3fc5-719f-4354-a800-13932d8ce546}UA Email Authentication.fields.{1b8832e2-14cb-4072-834d-55961f1348ad}EmailAuthenticationidPk'] ), a!textField( label : "Email", value: fv!item['recordType!{d0cb3fc5-719f-4354-a800-13932d8ce546}UA Email Authentication.fields.{420c92b7-55eb-4b85-9466-c479d537c596}emailId'], saveInto: fv!item['recordType!{d0cb3fc5-719f-4354-a800-13932d8ce546}UA Email Authentication.fields.{420c92b7-55eb-4b85-9466-c479d537c596}emailId'] ) } ) ) }, addRowLink: a!dynamicLink( label : "Add Employee", saveInto: { a!save( ri!email, append( ri!email, 'recordType!{d0cb3fc5-719f-4354-a800-13932d8ce546}UA Email Authentication'( 'recordType!{d0cb3fc5-719f-4354-a800-13932d8ce546}UA Email Authentication.fields.{420c92b7-55eb-4b85-9466-c479d537c596}emailId': null, 'recordType!{d0cb3fc5-719f-4354-a800-13932d8ce546}UA Email Authentication.fields.{1b8832e2-14cb-4072-834d-55961f1348ad}EmailAuthenticationidPk': null ) ) ), a!save( ri!userDetails, 'recordType!{d8d2946d-462b-404a-ba5e-d96036a0edc1}UA User Detail'( 'recordType!{d8d2946d-462b-404a-ba5e-d96036a0edc1}UA User Detail.fields.{9a3cb925-d459-4387-8650-c358cd83c200}userIdPk': ri!userDetails['recordType!{d8d2946d-462b-404a-ba5e-d96036a0edc1}UA User Detail.fields.{9a3cb925-d459-4387-8650-c358cd83c200}userIdPk'], 'recordType!{d8d2946d-462b-404a-ba5e-d96036a0edc1}UA User Detail.fields.{7a392978-7d23-4f26-b793-21b77b8dcd7a}Email': ri!userDetails['recordType!{d8d2946d-462b-404a-ba5e-d96036a0edc1}UA User Detail.fields.{7a392978-7d23-4f26-b793-21b77b8dcd7a}Email'], 'recordType!{d8d2946d-462b-404a-ba5e-d96036a0edc1}UA User Detail.relationships.{da25471d-3af8-4d3a-8a55-262c411d41d6}uaEmailAuthentication': ri!email ) ) } ), selectionSaveInto: {}, validations: {}, rowHeader: 1, shadeAlternateRows: true ) } ) } ) }, buttons: a!buttonLayout( primaryButtons: { a!buttonWidget( label: "Submit", submit: true, style: "PRIMARY", loadingIndicator: true ) }, secondaryButtons: { a!buttonWidget( label: "Cancel", value: true, saveInto: {}, submit: true, style: "NORMAL", validate: false ) } ) ) )
Thanks for your reply.
I clicked the Add Employee link twice - in array I can see 2 rows, but in the Grid I don't see 2 rows to enter my details.
Hii saravanang0001,since you are using the foreach() in the rows parameter of gridLayout on the dept rule input you have to also append this to the dept rule input you can take reference to my code and let me know if you face any issues.thankyou
Prefect , thanks - it works. I have to refer the master record type (Dept).
Hii saravanang0001 , If you are satisfied with this, please verify it, as this confirmation can boost my confidenceThank you