Unable to update the existing record using Smart Service

 I'm trying to edit the existing record using the below smart service code where the new row getting added into the database but not updating the record. Can anyone guide me on this please.

 

a!writeToDataStoreEntity(dataStoreEntity: cons!DSE_Constant_GFO_CMB_fetchSBIDataSendforApproval,
valueToStore: ri!RI_3,
onSuccess: a!save(ri!RI_3,ri!RI_4))

Thanks,

  Discussion posts and replies are publicly visible

Parents Reply Children
  • nope, i'm new to appian. could you please guide me with more details
  • Okay. In appian CDTs ( Custom Data Types ) represents a Table structure and they are linked with Actual Table in Database via Datastore entities.

    In your above rule, you have mentioned ri!RI_3, it should be of a CDT type. Generally, in tables, we will have a primary key for Easy retrieve/update/delete specific row(s).

    If you look at your CDT and table definition ,There should be one field that is marked as a primary key. If not you have to create one and map it with your CDT.

    In Appian, there is a feature in CDT to make a field primary key and mark it AUTO GENERATED as well. That means you dont have to pass the value for the primary key while creation . while inserting the row into DB system will create the value.

    But when it comes to update you want to update a specific row which you can identify via primary key.

    In your above case, let's say table definition is as shown below and  id is your primary key

    id username isactive
    1  user1         1
    2  user2         1

    when you want to update row 2 to set isactive to false you should pass the data to update including the primary key.i.e.{id:2, username:user2,isactive: false()}