Skip to main content
April 14, 2024
Question

How to prepare record type in variable?

  • April 14, 2024
  • 4 replies
  • 0 views

Hello Everyone,

I am working with record type.

There is a requirement to prepare record type using rule input.

This is the logic I am using:

a!forEach(
  items: ri!reminderInfo,
  expression:fv!item['recordType!{e5a6a458-a1b1-4679-91c9-944cecdfdac6}AMS_DG Appointment Reminder.fields.{5515212e-0535-40f5-aa3e-1d92c83c23ca}appointmentId': index(ri!appointmentInfo,'recordType!{5746f330-8c31-4ea7-9807-cbbd2fd557eb}AMS_DG Appointment.fields.{274539be-ac91-4f4c-95ed-69bd50175dae}appointmentId',null),
  'recordType!{e5a6a458-a1b1-4679-91c9-944cecdfdac6}AMS_DG Appointment Reminder.fields.{e7f92751-d0c8-4ce6-a252-2bd4b3bee143}createdBy': index(ri!appointmentInfo,'recordType!{5746f330-8c31-4ea7-9807-cbbd2fd557eb}AMS_DG Appointment.fields.{9cc0bbe6-dc99-4b3c-bf8b-e70e36fbbbb0}createdBy',null),
  'recordType!{e5a6a458-a1b1-4679-91c9-944cecdfdac6}AMS_DG Appointment Reminder.fields.{82394d77-2331-4196-9d8e-3aaaf57888a3}createdOn': index(ri!appointmentInfo,'recordType!{5746f330-8c31-4ea7-9807-cbbd2fd557eb}AMS_DG Appointment.fields.{19a1f573-e088-4dd7-bc12-285695cf99c0}createdOn',null),
  'recordType!{e5a6a458-a1b1-4679-91c9-944cecdfdac6}AMS_DG Appointment Reminder.fields.{9239e959-1781-4c7f-9b71-83d00def8913}isActive': true()]
)

a!forEach(
items: ri!reminderInfo,
expression:fv!item['recordType!{e5a6a458-a1b1-4679-91c9-944cecdfdac6}AMS_DG Appointment Reminder.fields.{5515212e-0535-40f5-aa3e-1d92c83c23ca}appointmentId': index(ri!appointmentInfo,'recordType!{5746f330-8c31-4ea7-9807-cbbd2fd557eb}AMS_DG Appointment.fields.{274539be-ac91-4f4c-95ed-69bd50175dae}appointmentId',null),
'recordType!{e5a6a458-a1b1-4679-91c9-944cecdfdac6}AMS_DG Appointment Reminder.fields.{e7f92751-d0c8-4ce6-a252-2bd4b3bee143}createdBy': index(ri!appointmentInfo,'recordType!{5746f330-8c31-4ea7-9807-cbbd2fd557eb}AMS_DG Appointment.fields.{9cc0bbe6-dc99-4b3c-bf8b-e70e36fbbbb0}createdBy',null),
'recordType!{e5a6a458-a1b1-4679-91c9-944cecdfdac6}AMS_DG Appointment Reminder.fields.{82394d77-2331-4196-9d8e-3aaaf57888a3}createdOn': index(ri!appointmentInfo,'recordType!{5746f330-8c31-4ea7-9807-cbbd2fd557eb}AMS_DG Appointment.fields.{19a1f573-e088-4dd7-bc12-285695cf99c0}createdOn',null),
'recordType!{e5a6a458-a1b1-4679-91c9-944cecdfdac6}AMS_DG Appointment Reminder.fields.{9239e959-1781-4c7f-9b71-83d00def8913}isActive': true()]
)

This is the error pops up: Expression evaluation error in rule 'ams_dg_preparereminderrecord' at function a!forEach: Error in a!forEach() expression during iteration 1: Expression evaluation error: AMS_DG Appointment Reminder must be indexed by its corresponding record type fields or relationships) (Data Outputs).

Please help me with this

    4 replies

    karumurua531442
    April 14, 2024

    hi [mention:ec7f88b172ca4e978db91ce2a1e10e03:e9ed411860ed4f2ba0265705b8793d05]  may i know your complete requirement. are you trying index the field of your related record from your main record?

    You index in the following format as mentioned in images below

    initially you need to select the related record from your main record:

    .

    after that select the related record field from related record type as mentioned in image:

    let me know if this helps

    April 15, 2024

    Understood, Thank you

    shubhama926776
    Brainy
    April 14, 2024

    Make sure you're referencing the correct record type and field identifiers, and ensure the fields you're trying to access are accessible within the record type.
    Validate ri!reminderInfo is type of AMS_DG Appointment Reminder.

    शुभम्
    April 15, 2024

    Ok unnderstood