how do I only update specific fields when a primary key exists in data store? In Other words, bring in new records, while updating existing records, but do not overwrite certain fields (e.g. "Date first added").

The Appian Documentation below does not explain how to prevent the updating of an existing value. I want to bring in new data, but if the primary key already exists, then I want to retain some of the old data while updating other values.

I tried doing something like:

if(isnull(rule!Query_Existing(pv!data.PrimaryKey)), "new data", "old Data") and save into the field

And the rule above passes the primary key and searches for the "old Data". The rule works by itself, but when I do this if statement, I get a null pointer exception. 

Appreciate any help on this.

https://docs.appian.com/suite/help/21.4/Write_to_Data_Store_Entity_Smart_Service.html

Updating an Existing Value

The data that you write can update an existing record when a primary key is properly configured for the entity and provided by your node input.

Saving a New Value

Saving a new value for an existing record does not merge the records, the old record is overwritten.

  Discussion posts and replies are publicly visible