Cant use Wait for form task and resume Activity

Hi All,

i am getting the below error when using wait for form task and resume activity in studio.

ps- i am using the image classification model here and this(wait for form task) activity lies under the “if” condition which checks if the confidence score is less than the threshold score mentioned

@Anil_G @supermanPunch @ppr

Practice.zip (11.8 KB)
here is my workflow for your reference, kindly have a look at it

thanks

Search the forum for that error message. There are many discussions on that topic. To summarize you are using a datatype that cannot be serialized (serialization is how it stores the variables and values to be able to suspend and resume the job). You’ll have to find a way to code your process without using those datatypes.

To clarify, you can’t use those datatypes in the scope that has the wait for form task

Hi @postwick but i need to deserialize first after the ml skill activity kindly refer my workflow thanks

It has nothing to do with the serialize/deserialize activity. It has to do with how it saves the variable values when it suspends to wait for the form activity to be completed. You need to take those variables out of the scope that the Wait activity is in. There is no way around it. You’ll have to rework your automation to avoid those non-serializable datatypes in the same scope the Wait is in.

Getting confused brother, like i have to remove taskobject outside of wait activity?

The error message says you have a JObject variable in the scope that the Wait activity is in. JObject is not serializable, so it can’t suspend the job (Wait). You’ll have to find another way to store whatever you have in that JObject.

I looked at your project and there are a couple things here. You have the Form Task and Wait inside a loop. You don’t want to do that. What will happen is it’ll suspend the job on the first item in the loop and wait for the action to complete. When the form task is completed it will resume and do the next iteration of the loop. A Document Understanding process should be linear - top down, process one item.

You want a dispatcher automation that creates a queue item for each document. Then a separate performer automation on a queue trigger to take a queue item from the queue and process it - including creating the form task and waiting for it to be completed. Then you set your queue trigger to spawn as many jobs as your licensing can handle, so you end up with as many documents processed - and waiting actions - as you can.

Anyway, the issue with the serialization is your jobject variable (this is a really bad name for a variable, by the way, as jobject is a type. You shouldn’t name variables the same name as a type.) Anyway, you have the jobject variable scoped to Main, and your Wait activity is (of course) also inside that Main scope, so you get the serialization error.

As you can see in this modified project, I have split the steps into separate sequences and changed the jobject variable’s scope to the lowest it can be - the “classify and check confidence” sequence. If you look in the other scope (the “check confidence” sequence) you won’t see that jobject variable because it isn’t scope above that sequence.

Practice.zip (11.9 KB)

Your scoping:

  • Main - jobject is here
    ** For Each - contains the Wait activity, but the jobject also exists here because it’s scoped to the above Main, so it needs to serialize the jobject variable in order to suspend, but jobject is not serializable

Proper scoping:

  • Main
    ** Classify - jobject is here
    ** Form task and wait - jobject is not here

@Jai_Pande

Try using wait for form task in a different separate sequence or a separate workflow so that no variables would create a problem for it

Cheers

Like invoking it? @Anil_G

@Jai_Pande

Either a separate sequence around it …or invoke it…both should work

Cheers

One question @Anil_G that in wait task where i am using jobject? That its throwing an error kindly refer my work flow brother

You mean that i dont need to use the taskobject(input) variable, like i am confused that where am i using jobject in wait @postwick

@Jai_Pande

I referred it…in the same sequence as wait for resume you have deserialize activity also which uses jobject variable…

So basically when you use wait for resume…all the variables that are present in the sequence will be serialized and saved to let it resume as is…and when doing that few cannot be serialized like jobject etc

Cheers

ok @Anil_G so you mean to say that wait form task doesn’t expects deserialized json activity in same scope?

@Jai_Pande

Not Exactly…but it does nt expect few types of variables in same scope …so eventually not those qctivities which use those as well

Cheers

okay like where its written any documentation on it brother? @Anil_G

so we can use deserialized variables in wait form task? like i am not getting it that why it doesn’t expects deserialized variables i got the workflow just having this doubt