Skip to main content
September 10, 2025
Question

need to update nested cdt column data

  • September 10, 2025
  • 5 replies
  • 1 view

Hi

i have a process variable called request_data which is cdt type and in that there was one column called casettnotes which is a cdt casenotes cdt has currently 4 rows of data in that there was a column casenote which i need to update which is 4th row case note column data for this i dont have primary value it was null so i tried using other column which is issuetype like if issuetype is failed then update casenot for that issue type like that, all i want the casenote column which is 4th row column in casettnotes cdt need to be updated how to acheive this tried using many alforeach with update function but nothing working kindly suggest on this

5 replies

harshas2775
September 10, 2025

It is very difficult to understand the structure this way. Can you try creating a map with how actually your cdt structure is and for which cdt which field you are facing challenge. Some example of what your input is and expected output is will be helpful too. 

shubhama926776
September 10, 2025

I tried to replicate your issue with map.
Try it once for your CDT and let me know if that works for you.

a!localVariables(
  local!request_data: a!map(
    requestId: 123,
    requestType: "Service Request",
    casettnotes: {
      a!map(
        id: null, 
        issuetype: "pending", 
        casenote: "First case note - pending review",
        createdDate: today()-3
      ),
      a!map(
        id: null, 
        issuetype: "approved", 
        casenote: "Second case note - approved by manager",
        createdDate: today()-2
      ),
      a!map(
        id: null, 
        issuetype: "review", 
        casenote: "Third case note - under review",
        createdDate: today()-1
      ),
      a!map(
        id: null, 
        issuetype: "failed", 
        casenote: "Fourth case note - THIS NEEDS UPDATE",
        createdDate: today()
      )
    }
  ),

  local!newNoteValue: "UPDATED: Fourth row has been successfully modified",

  local!updatedData: a!update(
      local!request_data,
      "casettnotes",
      a!forEach(
        items: local!request_data.casettnotes,
        expression: if(
          /* Condition: Update 4th row OR where issuetype = "failed" */
          or(
            fv!index = 4,
            fv!item.issuetype = "failed"
          ),
          a!update(
            fv!item,
            "casenote",
            local!newNoteValue
          ),
          fv!item
        )
      )
    ),
  
  local!updatedData
)

September 10, 2025

thank you so much for code 

casetnotes cdt has many columns like more that 20 do i need map every column could you please confirm? 

shubhama926776
September 10, 2025

No!  a!update() only modifies the fields you specify and automatically preserves all other columns unchanged.