Mapping Form Input without Contract

Hello All,

I created a form where not all of the information is not always mandatory for the form. When I map the form with a contract behind it the form doesn’t submit, but if I take items out of the contract they don’t get mapped when I do enter values. Any help is welcome! Thanks in advance!

Saludos!

Hi,

As you find out all contract inputs are mandatory. But the trick is that null value is accepted!

For example, if a contract define two text input: input1 and input2, following content is valid:
return {
‘input1’: “test”,
‘input2’: null
};

whereas the following one is not (you get an error 500 with answer: [Expected input [input2] is missing]):
return {
‘input1’: “test”
};

So you can set your form variables default value to be null and in your process, when you use contract input, first test if they are not null.

Hope this helps

Thank you for your reply!

In the input I have:
{
‘input1’ : {
attribute 1 ,
attribute 2,
},
‘input2’ : {
attribute 1 ,
attribute 2,
}
};

I have initialized the arrays simply putting: attribute1[0],
in those there are other variables.

I will try to initialize each specific variable with null or 0 and see if it works! Thanks. I’ll let you know next week. If it works I’ll check best answer!

Antoine,

I hope you are well. I’ve tested the method you suggested but it is not working the way I would have liked.

I was initializing form input the following way:

{ "mainInput1" : { "iteratedInput1" : [null] }, "mainInput2" : { "iteratedInput2" : [null] } }

I then attempted to initialize things like you suggested:

{
“mainInput1” : {
“iteratedInput1” : {
“attribute1”:null,
“attribute2”:null,
“attribute3”:null
}
},
“mainInput2” : {
“iteratedInput2” : [null]
}
}

The problem is when I create the form, I get 4 iterations pre-loaded rather than just one I can use an “Add” Button if I need more.

Thanks for your help!

Hi,

Can you share your process .bos file so I can better understand your use case?

Thanks

Antoine,

Here is the file. I recognized its not process related but rather the json definition. Example BOS file The first tab is initialized in the way I would like to see on the form. The second tab is what happens when I try to initiallize each of the variables. I see that the number of lines is dependent on the number of attributes defined in formInput. So if I want to initiallize them with null I would be creating additional instances in the form.

Let me know if you need anything else.

Hi,

I update your example to initialize the widgets values using the form variable. The same variable is also used to store information about user input and selection.

Hope it’s helping. If not, I think a business use case description might help to understand what you are trying to achieve.

Antoine, thank you very much, your solution worked!

Good news! If you are happy with the product can ask you to share your feedback on IT Central Station?

Antoine, when I initialize

attribute:null,

and send the data it creates new instances with values of null in all the initialized objects. I don’t want to fill my BDO’s with records fill with null. Am I doing this right? Thanks

I will try first to sum up my understanding of your development:

  • You have a form that behave as you expect.
  • The form also let you create a JSON variable that includes all content you want to send to the process in order to store them in a new business data entry.
  • The data received by the process match the contract definition.

Your issue is now that the business variable new entry does not contains what you expect. More precisely it contains an entry matching a null value for a data attribute.

Can you confirm my understanding is correct?

If yes I think I will need from you a bos file with form, process and business data model definitions in order to help you.

Antoine,
Thanks for your help. You are correct in your understanding. Here is the BOS

Let me know if you need anything else.

Luis

In order to help I think I will need a step by step scenario to reproduce your issue.

I need to understand the sequence of actions and value you inputs in various fields.

Thanks