Array as parameter to a!startprocess

 Hi,

I have an array of cdt as below and i am using 
saveInto: a!startProcess(
processModel: cons!Part_Updates_Const,
processParameters: ri!partInfo,
onSuccess: a!httpResponse(body:{"Well done"})
),
style: "NORMAL"
)
}

in a button to kick a process model.

Question 1: How can i send an array instead of just the dictionary as parameter? I am currently getting error: Could not cast from myType?list to Dictionary. Details: CastInvalid.

Question 2: Can the process model be started at click of the button ? Currently i have an input task that notifies me of the task and then i log in to select rows from the editable grid and click the button to start my process model which in turn kicks off other sub-processes that write to the database.

 

Array of cdt:

local!var:{type!{urn:com:appian:types:TYPES}myType(
Id:1,
StatusId: 23,
ParteId: 21,
partNumber: 3500,
partTypeId: PMAC560,
folderId:20,
createdBy: index(local!partInfo.data,"createdBy",{}),
createdDate:index(local!partInfo.data,"createdDate",{}),
modifiedBy: loggedInUser(),
modifiedDate: now()
),

type!{urn:com:appian:types:TYPES}myType(
Id:1,
StatusId: 23,
ParteId: 21,
partNumber: 3500,
partTypeId: PMAC560,
folderId:20,
createdBy: index(local!partInfo.data,"createdBy",{}),
createdDate:index(local!partInfo.data,"createdDate",{}),
modifiedBy: loggedInUser(),
modifiedDate: now()

),

type!{urn:com:appian:types:TYPES}myType(
Id:1,
StatusId: 24,
ParteId: 23,
partNumber: 3900,
partTypeId: PMAC560,
folderId:22,
createdBy: index(local!partInfo.data,"createdBy",{}),
createdDate:index(local!partInfo.data,"createdDate",{}),
modifiedBy: loggedInUser(),
modifiedDate: now()

)

}

  Discussion posts and replies are publicly visible

  • +1
    Certified Lead Developer

    Hi Parveen,

    Can try with the below format?

    a!startProcess(
                processModel: cons!Part_Updates_Const,
                processParameters: { processParamterVariableNameInProcessModel: ri!partInfo}
    )

     

    Please check the below link[version 18.2] for more details on passing input to processParameters:

    docs.appian.com/.../Start_Process_Smart_Service.html

  • Hello Parveen,

    1) For your first question, when using the functions startProcess, startProcessLink and startProcess smart service you have to pass in the processParameter a dictionary as Vimal showed in his example, the dictionary needs to include the names of each parameter so the engine will be able to map them.
    Specifically to send the array you just need to map it , and set the variable as multiple, seems like you Are near to the solution.
    processParameters:{array:local!var}

    2) you can start a process from a link, but you need to decide what is next after clicking the button.

    If you need start a proces and then trigger another task (to show the result) using activity chain, then you need the function startProcessLink. I don’t remember been able to trigger from a Button qhich doesn’t submit the page.

    If you just need to trigger the process asynchronous then you can use the function startProcess. Inside a button. Since this does not refresh and chain the page this can be easily incorporated to the buttons.

    It is up to you which one matches your use case.


    Jose
  • Worked like a charm. Thanks for the tip. I asked another question Vimal how can I trigger a sub process at the button click ? Currently i click button then an input task sends notification and i open the form, provide input then click submit button to trigger other sub-processes. I want to remove input task and trigger sub-processes at the button click.
  • Jose,

    I did not notice your answer. Thanks for answering the questions. For my second question, how do i configure my process mode? Currently i have an input task which i want to remove. I just want asynchronous execution of the process model. Not sure how to configure my process model.
  • 0
    Certified Lead Developer
    in reply to Parveen
    Parveen,
    Sorry, I didn't notice your second question and also I am not able to get your requirement on that.
    Are you looking for a way to start an another process and complete the task in that? If yes, you can try startprocesslink as jose suggested.
    Here is documentation link to it: docs.appian.com/.../Start_Process_Link_Component.html