Skip to main content
Participating Frequently
August 20, 2026
Question

How to mix relationShip and Fields in update() function ?

  • August 20, 2026
  • 6 replies
  • 40 views

Hi,

Could you explain me why the mix of relationShips and fields in “index/value”, does not work in a a!update() function  please ?

Do I have any other choice but to call 2 consecutive a!update()?

/* Works fine: */

a!update(
data: local!data,
index: {
recordType!Project.fields.createdBy,
recordType!Project.fields.createdOn
}
value: {
"my.user",
now()
}
)

/* Works too: */

a!update(
data: local!data,
index: recordType!Project.relationships.Document,
value: local!docs
)

/* Does not work: */

a!update(
data: local!data,
index: {
recordType!Project.relationships.Document,
recordType!Project.fields.createdOn
}
value: {
local!docs,
now()
}
)

Regards

6 replies

harshas2775
Brainy
August 20, 2026

I tried to test the scenario to update related record field and record field with one a!update() command and it worked for me. So it is not a limitation.

In your case are you trying to update multiple documents (local!docs) to the Document field of related record? If so, then try doing it one at a time or build value with related record type constructor such as below within a!foreach(). 

a!update(
data: recordType!Customer(Address: null),
index: recordType!Customer.relationships.Address,
value: recordType!Address(zip: 12345)
)


 

Participating Frequently
August 21, 2026

yes harshas2775, in my case, I was trying with multiple documents :
 

local!docs: {
recordType!Document(
recordType!Document.fields.id: 1,
recordType!Document.fields.label: "doc1"
),
recordType!Document(
recordType!Document.fields.id: 2,
recordType!Document.fields.label: "doc2"
)
}


 

mikes0011
Brainy
August 20, 2026

I’m guessing it’s due to your combined update call attempting to mix between updating of singular and array elements (i don’t know what sort of extra complexity is drummed up in the back-end when attempting to update a plural relationship, but i imagine it gets pretty hairy). 

I’m less clear whether this is intentional behavior or not - like, if your attempted use case could be interpreted by Appian with zero ambiguity as to what the outcome should be, perhaps it’s something to flag to request for them to fix.  For the moment though, I’m guessing you’re stuck using some workaround like Harsha suggested, or some other two-step solution (like a double-nested a!update() call).

The Expression Guru
stefanhelzle0001
Brainy
August 21, 2026

Is this a large record? If not, it might be easier to create a new one, copying some of the fields from the old, while adding some new values.

Participating Frequently
August 21, 2026

Stefan, it’s not a big issue for me, because I use two consecutive updates as a workaround to make it work. I was just curious why I can execute this code:

localvariable: 
local!docs: {
recordType!Document(
recordType!Document.fields.id: 1,
recordType!Document.fields.label: "doc1"
),
recordType!Document(
recordType!Document.fields.id: 2,
recordType!Document.fields.label: "doc2"
)
},

a!update(
data: local!data,
index: {
recordType!Project.relationships.Document,
recordType!Project.fields.createdOn
}
value: {
local!docs,
now()
}
)
)

 

adityag9712
Inspiring
August 22, 2026

Hello, I per my understanding, whenever we uses any Appian function please go through function description. 

By reading it 2-3 times, we can get that it can only able to update a dictionary or the map function or the record Type, but as we involving the other related record the dictionary structure different so its not updating it for the related record records. 

- Aditya