Appian Community and Appian Academy are being upgraded. From July 24–August 3, the Appian Community will be in read-only mode. During this time, the site will be read-only and user registration will be disabled. We apologize for any inconvenience this may cause, but a more secure, stable, and performant Community experience is coming soon!

The new Appian Community launches August 3, followed by Appian Academy on August 7. During the migration, Appian Community Edition, Appian Academy, Documentation, Certifications, Instructor-led Customer Training, Partner Sales Training & Accreditation, and Forum (for Appian Partners and Customers only) will remain available.

Unable to stop the Race conditions in a process model

 When I select the items in the grid and click on the button in the background the process model should trigger, and it must complete successfully, But when I click the button instantly twice or thrice immediately another process model is triggering the items which have selected becomes duplicate in next section. So, Here race condition occurs. Actually, we tried to restrict that button not to click it a second time by the user. The problem is before writing to the DB by the first process model in the fraction of seconds processes model also. In the interface, we are passing the selected items through the start process and try to capture the output. But nothing works. Let me know is there any way to stop the race condition either in an interfcae or process model

  Discussion posts and replies are publicly visible

Parents
  • To start us off here, why is a process model required to write data to the DB on a button click while the interface is still active?  If this is a requirement, note utilizing a!writeToDataStoreEntity() on the button click instead is much lighter and much easier to control.  

    Additionally, if you set a flag on the button click, users should only be able to click once - potentially reset the flag to false if any data is modified that might need to be persisted to the DB?  Otherwise if you can post more details about your configuration and use case, that would assist here.

    a!localVariables(
      local!buttonClicked: false,
      
      {
        a!buttonArrayLayout(
          buttons: {
            a!buttonWidget(
              label: "Write Data",
              value: true,
              disabled: local!buttonClicked,
              saveInto: {
                local!buttonClicked,
                a!writeToDataStoreEntity(
                  dataStoreEntity: cons!COE_DS_TESTING,
                  valueToStore: 'type!{urn:com:gdit:types}COE_TESTING'(data: "test")
                )
              }
            )
          }
        )
      }
    )

Reply
  • To start us off here, why is a process model required to write data to the DB on a button click while the interface is still active?  If this is a requirement, note utilizing a!writeToDataStoreEntity() on the button click instead is much lighter and much easier to control.  

    Additionally, if you set a flag on the button click, users should only be able to click once - potentially reset the flag to false if any data is modified that might need to be persisted to the DB?  Otherwise if you can post more details about your configuration and use case, that would assist here.

    a!localVariables(
      local!buttonClicked: false,
      
      {
        a!buttonArrayLayout(
          buttons: {
            a!buttonWidget(
              label: "Write Data",
              value: true,
              disabled: local!buttonClicked,
              saveInto: {
                local!buttonClicked,
                a!writeToDataStoreEntity(
                  dataStoreEntity: cons!COE_DS_TESTING,
                  valueToStore: 'type!{urn:com:gdit:types}COE_TESTING'(data: "test")
                )
              }
            )
          }
        )
      }
    )

Children
No Data