How do I retain values in Local Variable after a!startProcess

Certified Associate Developer

I have a button on an interface that is used to start Process using a!startProcess in the background. Now I want the values of the field to be retained. Once the process the completed, all the local variables are refreshed to empty or null values. How do I retain these values.

For other fields I am using ri! but for a particular values that I am having operations on in the interace I am bound to use local variable here. Am I missing something here? I tried using rule inputs, but the usecase requires me use a local variable here. Also tried saving this to an ri! and onSuccess saving back to local! but that didn't help. Any help or direction that I should be looking towards to solve this?

  Discussion posts and replies are publicly visible

  • 0
    Certified Lead Developer

    In my interfaces a!startProcess does not refresh anything unless I add a bunch of a!save(). Can you share some code?

  • 0
    Certified Lead Developer

    I would assume that you can save to the local variable via the onSuccess.

  • 0
    Certified Associate Developer
    in reply to Stefan Helzle

    I have my local Variable local!initialReminder which is sent to a separate section Inteface, The values are populated there.

    My Button SaveDraft has a a!startProcess inside a SaveInto parameter. before that I'm doing a bunch of saves but that's on different CDT. OnSuccess I'm further doing some saves but those are on Process variables again different CDTs, My local!initialReminder  is not touched. Except this particular save which passes this variable

    a!save(
                    ri!reminderEmailDetails,
                    rule!EA_prepareReminderList(
                      initialReminder: local!initialReminder,
                      beforeDueDateReminder: local!beforeDueDateReminder,
                      afterDueDateReminder: local!afterDueDateReminder,
                      finalReminder: local!finalReminder,
                      isPreDeadLineReminderChecked: local!ispreDeadLineReminder,
                      isPostDeadLineReminderChecked: local!ispostDeadLineReminder,
                      isBreachReminderChecked: local!isBreachReminder,
                      adhocReminder: local!adhocReminder
                    )
                  ),

    Also this save is before my startProcess.

  • 0
    Certified Associate Developer
    in reply to Mathieu Drouin

    I'm passing this value via a local!Variable to a separate interface , wouldn't it be redundant to save localVariable back to the same Variable?

    Tried this approach as well just to try my luck,  but alas!

    onSuccess:{
                    a!save(local!draftBtnClicked, true),
                    a!save(ri!attestationDetails, fv!processInfo.pv.attestationDetails),
                    a!save(ri!questions, fv!processInfo.pv.questions),
                    a!save(ri!reminderEmailDetails, fv!processInfo.pv.reminderDetails),
                    
                    a!save(local!initialReminder, local!initialReminder)
                    }

    Here's how my sectionLayout that hold the particular screen is: Is this a wrong approach?

    a!sectionLayout(
                      contents: {
                        rule!EA_captureReminderDetails(
                          attestationDetails: ri!attestationDetails,
                          initialReminder: local!initialReminder,
                          adhocReminderEmail: local!adhocReminder,
                          isModifybuttonSelected: local!isModify,
                          /*attestationAddInfo: ri!attestationAddInfo,*/
                          parentAttestationAddInfo: ri!parentAttestationAddInfo
                        )
                      },
                      showWhen: local!activeStep = 4
                    ),

  • 0
    Certified Lead Developer
    in reply to arib_Anwar

    What is this "Save Draft" button doing? Does it submit?

  • 0
    Certified Associate Developer
    in reply to Stefan Helzle

    Nope the Submit is false, but I found my mistake. When defining the variable I was using an IF Condition and each time the condition was false it reverted to {} Empty value. Such a silly mistake I overlooked.

    nevrtheleass I have used refreshvariable and switched to refreshOnReferencedVarChange to FALSE. Thanks for helping me debug this step by step.

  • 0
    Certified Associate Developer
    in reply to Mathieu Drouin

    I found the issue, it was with my definition of local Variable. Thanks for helping me pin point this. I was assuming it's some kinda behaviour of startProcess to revert the values.