a!localVariables( local!bookinfo: if( a!isNotNullOrEmpty( ri!Lms_issuebook['recordType!{01e3b0e9-0572-442f-afd0-5278d2e5255e}LMS_books_issue.fields.{550c5ea8-8a07-4a21-9693-209c159c6319}bookId'] ), a!queryRecordType( recordType: 'recordType!{767ebc5c-7e43-47d6-926e-02e87bfe4826}LMS_BOOK', fields: { 'recordType!{767ebc5c-7e43-47d6-926e-02e87bfe4826}LMS_BOOK.fields.{92b7d831-6d1e-4319-941c-66d2c1b49a9f}author', 'recordType!{767ebc5c-7e43-47d6-926e-02e87bfe4826}LMS_BOOK.fields.{39d871be-ff6b-43bc-8200-4f5764212db4}availableCopies', 'recordType!{767ebc5c-7e43-47d6-926e-02e87bfe4826}LMS_BOOK.relationships.{23c62a5c-04db-4f30-89f0-4ccc4bb61a47}lmsGenre.fields.{d2da18ac-f795-482a-99d8-914552162ac1}value' }, filters: a!queryFilter( field: 'recordType!{767ebc5c-7e43-47d6-926e-02e87bfe4826}LMS_BOOK.fields.{8a72e153-4658-455c-a313-dc3d895c5ed3}bookId', operator: "=", value: ri!Lms_issuebook['recordType!{01e3b0e9-0572-442f-afd0-5278d2e5255e}LMS_books_issue.fields.{550c5ea8-8a07-4a21-9693-209c159c6319}bookId'], applyWhen: not( a!isNullOrEmpty( ri!Lms_issuebook['recordType!{01e3b0e9-0572-442f-afd0-5278d2e5255e}LMS_books_issue.fields.{550c5ea8-8a07-4a21-9693-209c159c6319}bookId'] ) ) ), pagingInfo: a!pagingInfo( startIndex: 1, batchSize: 1 ) ).data, null ), local!Studentinfo: if( a!isNotNullOrEmpty( ri!Lms_issuebook['recordType!{01e3b0e9-0572-442f-afd0-5278d2e5255e}LMS_books_issue.fields.{20627a17-9010-4ff5-b75a-70f29f4405ec}studentId'] ), a!queryRecordType( recordType: 'recordType!{c7fc79d2-ef67-41d8-9719-14d4743e079e}LMS_student', fields: { }, filters: a!queryFilter( field: 'recordType!{c7fc79d2-ef67-41d8-9719-14d4743e079e}LMS_student.fields.{eebb0aa5-c069-496c-a9ee-0ec306b9e395}id', operator: "=", value: ri!Lms_issuebook['recordType!{01e3b0e9-0572-442f-afd0-5278d2e5255e}LMS_books_issue.fields.{20627a17-9010-4ff5-b75a-70f29f4405ec}studentId'], applyWhen: not( a!isNullOrEmpty( ri!Lms_issuebook['recordType!{01e3b0e9-0572-442f-afd0-5278d2e5255e}LMS_books_issue.fields.{20627a17-9010-4ff5-b75a-70f29f4405ec}studentId'], ) ) ), pagingInfo: a!pagingInfo( startIndex: 1, batchSize: 1 ) ).data, null ),
a!formLayout( titleBar: a!headerTemplateFull( title: "Issue Book", secondaryText: "Enter Book Details", backgroundColor: "ACCENT" ), showTitleBarDivider: false, contents: { a!columnsLayout( columns: { a!columnLayout( contents: { a!pickerFieldRecords( label: "Book", labelPosition: "ABOVE", placeholder: "Select Book", maxSelections: 1, recordType: 'recordType!{767ebc5c-7e43-47d6-926e-02e87bfe4826}LMS_BOOK', value: ri!Lms_issuebook['recordType!{01e3b0e9-0572-442f-afd0-5278d2e5255e}LMS_books_issue.fields.{550c5ea8-8a07-4a21-9693-209c159c6319}bookId'], saveInto: { ri!Lms_issuebook['recordType!{01e3b0e9-0572-442f-afd0-5278d2e5255e}LMS_books_issue.fields.{550c5ea8-8a07-4a21-9693-209c159c6319}bookId'] }, openLinksIn: "NEW_TAB", validations: { if( not(a!isNullOrEmpty(ri!Lms_issuebook['recordType!{01e3b0e9-0572-442f-afd0-5278d2e5255e}LMS_books_issue.fields.{550c5ea8-8a07-4a21-9693-209c159c6319}bookId'])) & local!bookinfo['recordType!{767ebc5c-7e43-47d6-926e-02e87bfe4826}LMS_BOOK.fields.{39d871be-ff6b-43bc-8200-4f5764212db4}availableCopies'] = 0, "There are no available copies to issue", null ) } ) } ), a!columnLayout( contents: { a!boxLayout( label: "Student Info", contents: { a!textField( label: "Student", value: local!Studentinfo['recordType!{01e3b0e9-0572-442f-afd0-5278d2e5255e}LMS_books_issue.filters.{adb81449-9843-41d1-a8f4-856083589768}LMS_student'], readOnly: true ), a!textField( label: "Phone", value: local!Studentinfo['recordType!{767ebc5c-7e43-47d6-926e-02e87bfe4826}LMS_BOOK.relationships.{23c62a5c-04db-4f30-89f0-4ccc4bb61a47}lmsGenre.fields.{d2da18ac-f795-482a-99d8-914552162ac1}value'], readOnly: true ), a!textField( label: "Phone", value: local!Studentinfo['recordType!{767ebc5c-7e43-47d6-926e-02e87bfe4826}LMS_BOOK.fields.{39d871be-ff6b-43bc-8200-4f5764212db4}availableCopies'], readOnly: true ) }, style: "INFO", marginBelow: "STANDARD" ) } ) }, ), a!columnsLayout( columns: { a!columnLayout( contents: { a!pickerFieldRecords( label: "Student", labelPosition: "ABOVE", placeholder: "Select Book", maxSelections: 1, recordType: 'recordType!{c7fc79d2-ef67-41d8-9719-14d4743e079e}LMS_student', value: ri!Lms_issuebook['recordType!{c7fc79d2-ef67-41d8-9719-14d4743e079e}LMS_student'.], saveInto: { ri!Lms_issuebook['recordType!{01e3b0e9-0572-442f-afd0-5278d2e5255e}LMS_books_issue.fields.{550c5ea8-8a07-4a21-9693-209c159c6319}bookId'], a!save( ri!Lms_issuebook['recordType!{01e3b0e9-0572-442f-afd0-5278d2e5255e}LMS_books_issue.fields.{29217e95-0a87-4228-953a-f859a50e0764}dueDate'], today()+10 ), }, openLinksIn: "NEW_TAB", validations: { if( not(a!isNullOrEmpty(ri!Lms_issuebook['recordType!{01e3b0e9-0572-442f-afd0-5278d2e5255e}LMS_books_issue.fields.{550c5ea8-8a07-4a21-9693-209c159c6319}bookId'])) & local!bookinfo['recordType!{767ebc5c-7e43-47d6-926e-02e87bfe4826}LMS_BOOK.fields.{39d871be-ff6b-43bc-8200-4f5764212db4}availableCopies'] = 0, "There are no available copies to issue", null ) } ), a!dateField( label: "Due Date", value: ri!Lms_issuebook['recordType!{01e3b0e9-0572-442f-afd0-5278d2e5255e}LMS_books_issue.fields.{29217e95-0a87-4228-953a-f859a50e0764}dueDate'], saveInto: ri!Lms_issuebook['recordType!{01e3b0e9-0572-442f-afd0-5278d2e5255e}LMS_books_issue.fields.{29217e95-0a87-4228-953a-f859a50e0764}dueDate'], ) } ), a!columnLayout( contents: { a!boxLayout( label: "Student Info", contents: { a!textField( label: "Author", value: local!Studentinfo['recordType!{c7fc79d2-ef67-41d8-9719-14d4743e079e}LMS_student.fields.{eebb0aa5-c069-496c-a9ee-0ec306b9e395}id'], readOnly: true ), a!textField( label: "Phone", value: local!Studentinfo['recordType!{c7fc79d2-ef67-41d8-9719-14d4743e079e}LMS_student.fields.{f60de98f-d913-429f-aac1-95b921a0bae3}phone'], readOnly: true ), a!textField( label: "Email", value: local!Studentinfo['recordType!{c7fc79d2-ef67-41d8-9719-14d4743e079e}LMS_student'.], readOnly: true ) }, style: "INFO", marginBelow: "STANDARD" ) } ) } ) }, buttons: a!buttonLayout( primaryButtons: { a!buttonWidget( label: "Submit", submit: true, style: "SOLID", loadingIndicator: true, saveinto: { a!save( ri!Lms_issuebook['recordType!{01e3b0e9-0572-442f-afd0-5278d2e5255e}LMS_books_issue.fields.{a9b0afa6-acd2-4bf1-9f6a-35ccd18018a0}modifiedBy'], loggedInUser(), ), a!save( ri!Lms_issuebook['recordType!{01e3b0e9-0572-442f-afd0-5278d2e5255e}LMS_books_issue.fields.{e6f90fe2-2557-4793-b94a-35ffae570b5f}modifiedOn'], now(), ) } ) }, secondaryButtons: { a!buttonWidget( label: "Cancel", value: true, saveInto: {}, submit: true, style: "OUTLINE", validate: false ) } ) ))
Discussion posts and replies are publicly visible
I can see multiple issues in your codeIssue 1: '.], at the end - should be a proper field referenceIssue 2:Saving selected student to bookId field instead of studentId fieldIssue :3:'.], at the end - should be a proper field referenceLike this there are multiple issues with your code review your code properly.. LMS_books_issue record has bookId and studentId fields that store references to other records. Your book picker works because it references the bookId field within LMS_books_issue. Your student picker fails because you're referencing LMS_student record type directly instead of the studentId field within LMS_books_issue. Can't find this path since LMS_student isn't a field in your current record. Fix: Reference the studentId field in LMS_books_issue, not the LMS_student record type directly. Always reference the relationship field in your current record type, not the target record type.