How to insert data from interface to table?

I'm new to Appian, i want to insert data to my table.

1. Created a CDT with elements for Leave Request(Employee Name, Email, LStartDate, LEndDate)
2. Created datasource and assigned CDT to it.
3. Created Form from scrach and added fields with rule input on it.

now i want to create data store entity smart service to insert my data from Form to table Leave Request.

how to create data store entity smart service and call on submit button clicked.

  Discussion posts and replies are publicly visible

Parents Reply Children
  • You have to create a separate rule input for a cdt which typed of the CDT, you have created. Then save all the fileds in this single CDT typed rule input and pass this rule input to valueToStore. 

    Thanks

  • 0
    Certified Lead Developer
    in reply to bhushanb0001

    Why are you storing the values in separate ri! variables instead of in a single CDT ri! variable? 

    If you have a specific/important reason to do it that way, then we can handle your use case with one or two extra steps, but if you don't need those separate rule inputs, then your values should just be saved into the fields of a CDT rule input then you just reference the CDT within your write to data store.

  • 0
    Certified Lead Developer
    in reply to bhushanb0001

    Value to store has to be the same type as the CDT used to create the datastore.  You need to make a custom datatype with the values that you need, then input one of those as the valueToStore.

    ri!leaveRequest.employeeName, ri!leaveRequest.email, ri!leaveRequest.startDate, ri!leaveRequest.endDate

    then your database write is just a!writeToDataStoreEntity(datastoreEntity: cons!DATA_STORE_ENTITY, valueToStore: ri!leaveRequest

    )

    All the other fields are already inside the leaveRequest CDT.  It's got everything you need contained in one place.

    If you have a strong need to store the inputs in separate rule inputs, you could merge them all together at the end into a leaveRequest by using the type constructor as your value to store.  Honestly I agree that's most likely an extra unneeded step in this instance.