What kind of field would you use in an Appian interface to display [but not allow editing] of a field like "created by" and "created date"

Hi all,

My question is:

What kind of field would you use in an Appian interface to display [but not allow editing] of a field like "created by" and "created date" that you want to display but not allow user editing - such that the data from these fields is actually stored into the database.

Details of issue:

My colleague and I are fairly new to appian development and are working on a problem.

She created an interface that that allows us to add and edit the rows in a particular reference table.

The interfae [mostly] works - in that it allows you to add and edit rows in the database table.

The problem we have however is that there are some fields, which are not supposed to be directly edited by users. For example:

"Created by"
"Created date"

Rather than the users adding values for these fields, we want them to be automatically set by the system by retrieving the currently logged in user and the system date.

My colleague has been able to set the field values to their initial states using the loggedInUser() function and the now() function.

a!textField(
label: "Created by",
labelPosition: "ABOVE",
value: if(ri!RefDataTable.referenceId, ri!RefDataTable.createdby , loggedInUser()),
saveInto: a!save(ri!RefDataTable.createdby, upper(save!value)),
characterLimit: 255,
)

and

a!localVariables(
local!storedValue1:now(),
a!dateTimeField(
label: "Created Date and Time",
value: if(ri!RefDataTable.referenceId, ri!RefDataTable.createddate, local!storedValue1),
saveInto:{
a!save(ri!RefDataTable.createddate, local!storedValue1)
},
)
)

However, it seems that these values are not transferred into the database unless the lose-focus event is triggered for the field, which causes the method recorded against the "saveInto" field to be executed.

So it becomes necessary for the user to manually click on each of these fields and then out of them again for the values to get into the object that will then be stored into the database. If this is not done, then even though the form appears to save the record, it does not actually save any of the data at all.

I am thinking that perhaps some field type other than a!textField() should be used for the "created by" fields. Further, perhaps some field type other than a!dateTimeField() should be used for the "date created" fields - since we don't actually want the user to edit these - but rather we simply want to store the values extracted from the system into these fields.

However, to date, we have not been able to figure out how to capture the point at which the data is stored to the database so that we can [simply] store the values into the database [presumably via the CDT] at the point the record is stored.

  Discussion posts and replies are publicly visible

Parents
  • 0
    Certified Senior Developer

    hi , if you want to make any field is read only then use readOnly parameter and set it as true. and yes if you dont interact with those fields then values configured into saveInto of these fields wont be working. In this case you can configure these save values in your submit button of the form. So if you want to save values in  createdBy and createdOn fields, then configure something like below

    a!buttonWidget(

    saveInto:{

    a!save(createdBy ,loggedInUser()),

    a!save(createdOn,now())

    }

Reply
  • 0
    Certified Senior Developer

    hi , if you want to make any field is read only then use readOnly parameter and set it as true. and yes if you dont interact with those fields then values configured into saveInto of these fields wont be working. In this case you can configure these save values in your submit button of the form. So if you want to save values in  createdBy and createdOn fields, then configure something like below

    a!buttonWidget(

    saveInto:{

    a!save(createdBy ,loggedInUser()),

    a!save(createdOn,now())

    }

Children
No Data