get mandatory fields in form (REST API)

1
0
-1

Hi all,
How can I know if an input in a form is mandatory or not through the REST API?
Also I'm trying to update a process variable's value by giving it a value in an instantiation form..but the variable is not updating, any help?

this is my formInput (JSON):

{
"requestInput" : {
"leaveStart" : null,
"dayCount" : null
},
"mycenas" : null
}

this is my formOutput:

return {
'requestInput': $data.formInput.requestInput,
'mycenas': $data.cenasValue.value
};

the variable I want to update is the "mycenas" one..the other one (BDM) is updating just fine.

1 answer

1
0
-1
This one is the BEST answer!

Hi,

You can retrieve the contract information dynamically by using this REST Api: http://documentation.bonitasoft.com/?page=bpm-api#toc7

Look for Retrieve the task contract chapter.

Cheers

Comments

Submitted by tcarmo20 on Fri, 12/09/2016 - 16:27

Thanks Lionel. This covers the mandatory inputs (which was the question ;)) but...do you know how I can obtain the non mandatory inputs aswell? By non mandatory inputs I mean the ones that are marked as not required in the ui designer! which, in turn, won't be in the task contract

Submitted by Lionel Palacin on Fri, 12/09/2016 - 16:34

Hi,

This is two different things.

The mandatory widget options are managed on the client side. The contract is managed on the server side.

So to get the contract definition, you will use a REST Api, as described in my initial answer, to interrogate the server and get the contract definition.

For the mandatory widgets, you will have to use Javascript to know if a widget is mandatory or not. But I got to say that I'm unsure what you would be the need for that. Because, as a web developer you know which widgets are mandatory or not since you configured them.

Thanks

Notifications