For multiple table to insert and correlate value to be found in another table

a!localVariables(
  /*
   * All of these local variables could be combined into the employee CDT and passed into
   * a process model via a rule input
   */
  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!isFutureHire is a placeholder varaiable used to set the validation group trigger.
  * When isFutureHire is set to true, a user can skip phone number and start date.
  */
  a!formLayout(
    contents: {
      a!textField(
        label: "Username",
        value: {ri!userinputsheet.kone_user_name},
        saveInto: {
          a!saveInto(ri!userinputsheet.kone_user_name,ri!userinputsheet.kone_user_name),
          a!saveInto(ri!userrole.NAME,ri!userinputsheet.kone_user_name),
         },
        required: true
      ),
      a!textField(
        label: "firstName",
        value: {ri!userinputsheet.FIRST_NAME},
        saveInto: {ri!userinputsheet.FIRST_NAME},
        required: true
      ),
      a!textField(
        label: "firstName",
        value: {ri!userinputsheet.LAST_NAME},
        saveInto: {ri!userinputsheet.LAST_NAME},
        required: true
      ),
      a!textField(
        label: "Email",
        value: {ri!userinputsheet.Email},
        saveInto: {
          a!saveInto(ri!userinputsheet.Email,ri!userinputsheet.Email),
          a!saveInto(ri!userrole.EMAIL,ri!userinputsheet.Email),
        },
        required: true
      ),
      a!dropdownField(
        label:"Role",
        placeholder:"---please fill your Role---",
        choiceLabels:local!allRole,
        choiceValues:local!allRole,
        value:ri!userinputsheet.Role,
        saveInto:{
        a!save(ri!userinputsheet.Role,ri!userinputsheet.Role),
        a!save(ri!userrole.ROLE_ID,
        a!forEach
        (items:rule!KONE_Development_Role_RoleId,
        expression:if(fv!item.Role=ri!userinputsheet.Role,fv!item.Role_Id,{})        
        )),
        a!save(ri!userrole.PHASE_ID,
        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:local!allBranch,
        choiceValues:local!allBranch,
        value:ri!userinputsheet.Branch,
        saveInto:{
        a!saveInto(ri!userinputsheet.Branch,ri!userinputsheet.Branch),
        a!saveInto(ri!userrole.BRANCH,ri!userinputsheet.Branch),
        a!save(ri!userrole.BRANCH_ID,
        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:local!allRegion,
        choiceValues:local!allRegion,
        value:ri!userinputsheet.Region,
        saveInto:{
        a!saveInto(ri!userinputsheet.Region,ri!userinputsheet.Region),
        a!saveInto(ri!userrole.REGION,ri!userinputsheet.Region),
        a!save(ri!userrole.REGION_ID,
        a!forEach
        (items:rule!KONE_Development_Region_RegionId,
        expression:if(fv!item.Region=ri!userinputsheet.Region,fv!item.Region_Id,{})        
        )),
        },
        required:true,       
      ),
      a!textField(
        label: "ManagerRole",
        value: {ri!userinputsheet.Manager_role},
        saveInto: {
          a!saveInto(ri!userinputsheet.Role,ri!userinputsheet.Role),
          a!saveInto(ri!userrole.ROLE,ri!userinputsheet.Role),},
        required: true
      ),
      a!dropdownField(
        label:"Language",
        placeholder:"---please fill your Language---",
        choiceLabels:local!allLanguage,
        choiceValues:local!allLanguage,
        value:ri!userinputsheet.Language,
        saveInto:{ri!userinputsheet.Language,
       
        a!save(ri!userrole.LANGUAGE_ID,
        a!forEach
        (items:rule!KONE_Development_Role_RoleId,
        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!saveInto(ri!userinputsheet.CE_LEVEL,ri!userinputsheet.CE_LEVEL),
          a!saveInto(ri!userrole.LEVEL,ri!userinputsheet.CE_LEVEL),
        },
        required: true
      ),
      a!textField(
        label: "Telephone Number",
        value: {ri!userinputsheet.Telephone_number},
        saveInto: {
          a!saveInto(ri!userinputsheet.Telephone_number,ri!userinputsheet.Telephone_number),
          a!saveInto(ri!userrole.TELEPHONE_NUMBER,ri!userinputsheet.Telephone_number),
        },
        required: true
      ),
      a!textField(
        label: "Exceptional Case Library View Right",
        value: {ri!userinputsheet.Exceptional_case_library_view_right},
        saveInto: {
          a!saveInto(ri!userinputsheet.Exceptional_case_library_view_right,ri!userinputsheet.Exceptional_case_library_view_right),
          a!saveInto(ri!userrole.IS_EXCEPTION,ri!userinputsheet.Exceptional_case_library_view_right),
        },
        required: true
      ),
      
    },
    buttons: a!buttonLayout(
      primaryButtons: {
        a!buttonWidget(
          label: "Submit",
          saveInto:(
            a!writeToDataStoreEntity(
              dataStoreEntity: {cons!KONE_Development_userinputsheet_Constant,cons!KONE_Development_userrole_Constant},
              valueToStore:{ri!userinputsheet,ri!userrole }          
            ),
          ),
          submit: true,
          style: "PRIMARY"
        ),
       
      },
      
    )
  )
)

with report error with: Could not display interface. Please check definition and inputs. Interface Definition: Expression evaluation error [evaluation ID = 7603f:c4093] : An error occurred while executing a save: Expression evaluation error: userinputsheet must be indexed by its corresponding record type fields or relationships.

  Discussion posts and replies are publicly visible

Parents Reply Children
No Data