Submitting a record producer that creates a record under ''idea" table, the record creation fails with following error message"Data Policy Exception: The following fields are mandatory: Task"


Description

When submitting a record producer that should create a record under 'idea' table, the record creation fails with following error message "Data Policy Exception: The following fields are mandatory: Task". When a data policy named 'Make task field mandatory when state changes to In Backlog, Planning, In Development' is deactivated then this error message does not appear. 

Cause

The mentioned data policy is defined on 'im_idea_core' table which is the parent of 'idea' table. This data policy checks for the value of 'state' field, when it is in one of the following states [In Backlog, Planning, In Development], then 'task' field is made mandatory. The default value of 'state' field for 'idea' table is changed to 2, under the dictionary override. Additionally, the script inside the record producer had following line of code

current.state = 'idea';

But at the dictionary level, there was no choice found with this label [idea] under 'task', 'im_idea_core' or 'idea' table. Because of which it is using the default value of '2'. For parent table 'im_idea_core', the state field has a value of '2' for 'In Backlog'. Because of which the data policy got executed resulting in the error message.

Resolution

Anyways records created using the record producer should be in 'New' state by default [whose value is '1'] .Hence, explicitly setting the state field with correct value inside the record producer script, resolved the issue.

ie, Change the line of code

from:

current.state = 'idea';

To:
current.state = 1; // Where 1 corresponds to 'New' State