Skip to main content
floriang0001
April 23, 2021
Solved

When to set values of a rule input which are hidden to a user?

  • April 23, 2021
  • 5 replies
  • 0 views

Assume I have a form which saves many parameters into a rule input myDataDict of a custom data type with different entries, let's say myDataDict.name (required field) and myDataDict.common is directly visible on my interface. However, in addition to the visible things, I want to automatically populate myDataDict.timestamp with the date-time when the submit-button is pressed.

How do I do that in the most standard way? Where do I have to place my a!save()-call? Inside my a!buttonWidget() ?

Best answer by peter.lewis

You can also save as many fields as you need to using an array. For instance, 

a!buttonWidget(
  label: "Submit",
  submit: true,
  style: "PRIMARY",
  saveInto: {
    a!save(
      target: ri!customer.updatedOn,
      value: now()
    ),
    a!save(
      target: ri!customer.updatedBy,
      value: loggedInUser()
    ),
    a!save(
      target: ri!cancel,
      value: false
    )
  }
)

I always prefer using this method of saving data on the button because you can guarantee that all the other data has been entered - otherwise, the user wouldn't be able to submit the form!

5 replies

stefanhelzle0001
Brainy
April 23, 2021

I do that in the submit button. Have very good experience with it.

floriang0001
April 23, 2021

I am still not sure how exactly: May you share some code, please? Inside the saveInto() ?

April 23, 2021

Hi ,

As per your requirement you can try this code

a!buttonWidget(
label: "Submit",

saveInto: a!save(ri!abc,"abc"),
submit: true,
style: "PRIMARY"
)

thanks,