Appian Community and Appian Academy are being upgraded. As a part of the upgrade, Appian Community is currently in read-only mode, and user registration is disabled until August 3. We apologize for any inconvenience this may cause, but a more secure, stable, and performant Community experience is coming soon!
The new Appian Community launches August 3, followed by Appian Academy on August 7. During the migration, Appian Community Edition, Appian Academy, Documentation, Certifications, Instructor-led Customer Training, Partner Sales Training & Accreditation, and Forum (for Appian Partners and Customers only) will remain available.
Which function do we use to remove a particular field from a record before persisting it?
For example:
recordType!sampleRecord1( id: null, column1: A, column2: B, column3: C, column4: D, column5: E, column6: F, column7: G, column8: H, relationA: recordType!relationA( id: null, column1: A1, column2: B2, column3: C3 )) I want to remove the id field from both sampleRecord1 and relationA before persisting them.
Reason: The downstream database does not handle id: null well, but if the field is missing or field have a value, it works fine.
The output I want to save should be:
recordType!sampleRecord1( column1: A, column2: B, column3: C, column4: D, column5: E, column6: F, column7: G, column8: H, relationA: recordType!relationA( column1: A1, column2: B2, column3: C3 ))
Which function do we use to achieve this? i want to handle it dynamically rather mapping individual fields and then persisting .
Discussion posts and replies are publicly visible
There are no such functions to remove the field having null value from a record. However we can create an expression to check for null values and remap the record after removing null id fields from the record. There are considerations, of course, like what all fields need to be handled when their value is null depending on downstream system requirements. Below is a sample expression that checks for null id columns as per your description. Hope this gives a general idea.
For better understanding, I have formatted record types so that unnecessary uuids don't take space! Replace the record references with appropriate formatting.
a!localVariables( local!data: recordType!Case Main( recordType!Case Main.id: null, recordType!Case Main.name: "A", recordType!Case Main.submitter: "B", recordType!Case Main.relationships.DocRelation: { recordType!Case Document( recordType!Case Document.id: null, recordType!Case Document.size: 12 ) } ), local!NullIdRemovedChildData: a!forEach( local!data[recordType!Case Main.relationships.DocRelation], if( a!isNullOrEmpty( fv!item[recordType!Case Document.id] ), { recordType!Case Document( recordType!Case Document.size: local!data[recordType!Case Document.size] ) }, fv!item ) ), local!NullIdRemovedData: if( a!isNullOrEmpty( local!data[recordType!Case Main.id] ), recordType!Case Main( recordType!Case Main.name: local!data[recordType!Case Main.name], recordType!Case Main.submitter: local!data[recordType!Case Main.submitter], recordType!Case Main.relationships.DocRelation: local!NullIdRemovedChildData ), local!data ), local!NullIdRemovedData )