how can I prepopulate the fields of current task with previous completed task details

Certified Associate Developer

how can I prepopulate the fields of current task with previous completed task details?

  Discussion posts and replies are publicly visible

Parents
  • Hi ,

    To accomplish that, you have to pass the variable as reference between both tasks (within the process). Then, In Form 2 (Task Nº 2), use the ri! variables to set the values of the fields you want to populate.

    Dont forget to use activity classes and process variables correctly in order to obtain the desired result. Here is an example:


    Task 1 Interface





    Task 2 Interface



    Process



    Process Task 1 Detail







    Process Task 2 Detail



    Hope it helps,

    Rómulo

Reply
  • Hi ,

    To accomplish that, you have to pass the variable as reference between both tasks (within the process). Then, In Form 2 (Task Nº 2), use the ri! variables to set the values of the fields you want to populate.

    Dont forget to use activity classes and process variables correctly in order to obtain the desired result. Here is an example:


    Task 1 Interface





    Task 2 Interface



    Process



    Process Task 1 Detail







    Process Task 2 Detail



    Hope it helps,

    Rómulo

Children
  • 0
    Certified Associate Developer
    in reply to Rómulo

    Thank you for the reply  , need some clarification that with the above one can I populate the details in the same form 

  • Hi ,

    Yes, but please bear in mind the following:

    -Diferrent Processes: After see your last comment to Mike, and assuming that you have data store/database already configured, I may say that what you really want is populate a form with data which was previously stored (different process). So when a user instance a new task from a new process you want to display that data if exist (Name, Age, Country, Mail).

    To achieve this, you have to create a way to retrieve that data in a local variable when it loads the interface. For instance you can use a expression rule to retrieve that data:



    To know how to create a query entity rule, visit this page: https://docs.appian.com/suite/help/23.1/fnc_system_a_queryentity.html


    -Same Process: If the case is different tasks in the same process, you have to follow my first comment.

    Let us know if you made it :) ,

    Rómulo

  • 0
    Certified Associate Developer
    in reply to Rómulo

    Hi,

    Thank you so much it was working need one more help.Can I get an expression rule to retrieve the specific fields only from data store entity.

    Thank you

  • 0
    Certified Lead Developer
    in reply to sireesha
    Can I get an expression rule to retrieve the specific fields only from data store entity.

    a!queryEntity has the capability to specify the particular fields you want returned, when all you want is a subset of available fields.  What have you tried?

  • You're welcome.

    This will retrieve all the fields:



    For more info, please check: https://docs.appian.com/suite/help/23.1/fnc_system_a_queryentity.html

    Also , please vote up and verify the answer as correct, in order iit will be helpful for other user in the community.


    Thanks

    Rómulo

  • 0
    Certified Associate Developer
    in reply to Rómulo

    Thank you so much Romulo,

    Now I can retrieve the data so to prepopulate the same thing I have placed it in value parameter. when I open the form the previous data is prepopulating so I wanted it to change to something more with the existing data .so when I am doing that the form refreshes automatically and the modified data is not visible in the form.so how can I get rid of this could you please help me?


    label: "comments",
    labelPosition: "ABOVE",
    value: rule!T_EX(name:ri!expensedetails.name),
    saveInto: {ri!expensedetails.comments},
    refreshAfter: "UNFOCUS",
    required: true,
    height: "MEDIUM",
    validations: {},
    showWhen: ri!hra=true,

  • +1
    Certified Senior Developer
    in reply to sireesha

    This is not how this should be configured.

    You need to save the result of expression rule called inside value parameter in a localVariable and then use that variable in value and saveInto also to store the updated value in the same variable so that the updated value reflects as a display value.

    Please try updating your code with the below code.

    a!localVariables(
      local!data: rule!T_EX(name: ri!expensedetails.name),
      a!paragraphField(
        label: "comments",
        labelPosition: "ABOVE",
        value: local!data,
        saveInto: { local!data, ri!expensedetails.comments },
        refreshAfter: "UNFOCUS",
        required: true,
        height: "MEDIUM",
        validations: {},
        showWhen: ri!hra
      )
    )

  • 0
    Certified Associate Developer
    in reply to Sanchit Gupta (Xebia)

    Thank you very much Sachin Gupta,

    It was helpful,Sorry to trouble you again

    Does it works when there are two local variables 

    saveInto: {if(rule!APN_isBlank(local!repeatedinternalcomment),
                      (local!internalComment,
                      a!save(
                        ri!internalComment,
                        'type!{urn:com:appian:types:ISR}ISR_StudyComment'(
                          commentId: if(
                            rule!APN_isBlank(ri!internalComment.commentId),
                            {},
                            ri!internalComment.commentId
                          ),
                          comment: local!internalComment,
                          isInternal: true(),
                          reviewStage: cons!ISR_TEXT_REVIEWSTAGE_CODE_MEDIREV,
                          isActive: true(),
                          createdBy: loggedInUser(),
                          createdOn: now(),
                          updatedBy: loggedInUser(),
                          updatedOn: now()
                        )
                      )),
                      (local!repeatedinternalcomment,
                      a!save(
                        ri!internalComment,
                        'type!{urn:com:appian:types:ISR}ISR_StudyComment'(
                          commentId: if(
                            rule!APN_isBlank(ri!internalComment.commentId),
                            {},
                            ri!internalComment.commentId
                          ),
                          comment: local!repeatedinternalcomment,
                          isInternal: true(),
                          reviewStage: cons!ISR_TEXT_REVIEWSTAGE_CODE_MEDIREV,
                          isActive: true(),
                          createdBy: loggedInUser(),
                          createdOn: now(),
                          updatedBy: loggedInUser(),
                          updatedOn: now()
                        )
                      )))
                    },
    could you please help me
  • +1
    Certified Senior Developer
    in reply to sireesha

    Please use the insert code feature to paste the code.

    Not sure what you are trying to do here but I think the syntax should be like this.

    saveInto: if(
      rule!APN_isBlank(local!repeatedinternalcomment),
      {
        local!internalComment,
        a!save(
          ri!internalComment,
          'type!{urn:com:appian:types:ISR}ISR_StudyComment'(
            commentId: if(
              rule!APN_isBlank(ri!internalComment.commentId),
              {},
              ri!internalComment.commentId
            ),
            comment: local!internalComment,
            isInternal: true(),
            reviewStage: cons!ISR_TEXT_REVIEWSTAGE_CODE_MEDIREV,
            isActive: true(),
            createdBy: loggedInUser(),
            createdOn: now(),
            updatedBy: loggedInUser(),
            updatedOn: now()
          )
        )
      },
      {
        local!repeatedinternalcomment,
        a!save(
          ri!internalComment,
          'type!{urn:com:appian:types:ISR}ISR_StudyComment'(
            commentId: if(
              rule!APN_isBlank(ri!internalComment.commentId),
              {},
              ri!internalComment.commentId
            ),
            comment: local!repeatedinternalcomment,
            isInternal: true(),
            reviewStage: cons!ISR_TEXT_REVIEWSTAGE_CODE_MEDIREV,
            isActive: true(),
            createdBy: loggedInUser(),
            createdOn: now(),
            updatedBy: loggedInUser(),
            updatedOn: now()
          )
        )
      }
    )

  • 0
    Certified Associate Developer
    in reply to Sanchit Gupta (Xebia)

    Thanks you so much everything was worked out.Thanks alot