I'm trying to implement a record picker in a form. But I'm facing issues getting it behave the way I would prefer.
Currently I have an interface for the form and this is tied to a process model that uses the interface as a start form and takes the input from the form and calls a Write Record Smart service.
This all works as expected.
On the interface I have a rule import: ri!workflowTemplateId that holds the selected values of the RecordPicker.
In the processModel I have processVariable : pv!workflowTemplateId that this is passed into. My current issue is that when the form is loaded this value is coming in as "0" (I believe) so the RecordPicker field is pre selected but with an object "[Not Available]" because I obviously don't have an object with an ID of 0. I would like the RecordPicker field to be empty when entering the form but I cannot seem to get it to be empty. I have tried with this field as both an Integer field and as a List. How can I create initiate the form with no Record Preselected in the Workflow Template field?
RecordPicker code:
a!pickerFieldRecords( label: "Workflow Template", labelPosition: "ADJACENT", instructions: "", helpTooltip: "Select a valid template workflow to use for this event.", placeholder: "Select Template Workflow to Initiate", maxSelections: 1, recordType: 'recordType!{bb035f50-d14a-4303-9c20-48d3e48deab0}WPA1 Workflow Template', value: ri!workflowTemplateId, saveInto: ri!workflowTemplateId, required: true, openLinksIn: "NEW_TAB", validations: {} )
Start Form config:
ProcessVariables:
Discussion posts and replies are publicly visible
jonathanf3696 said:value is coming in as "0" (I believe) so the Rec
Please validate this. Add a field to your form that just shows this value.
Do you plan to select multiple templates? If no, do not make it a multiple.
So I confirmed that it's being set to 0 when entering the form:
In the ProcessModel, it appears that the value for that processVariable is being defaulted to "0". If I remove the value like the other ones, when I save it automatically changes back to 0.
So I tried setting the value =null() but that did not work either. In the end I changed the type of the variable to Text everywhere and it is working as expected now. I'm not using that value at the moment but I may need to convert to Integer when I do end up using it.
That's what I was expecting. Once a default value is set, you cannot remove it. Delete the PV and add it again, without giving a default value.
I think the problem is that when you add a Process Variable of Type Integer, it automatically defaults to 0. So if what you say is true, then you can never pass it as an integer value with no default. I'll have to try that again to verify it works that way.
You are right. I typically do not have that issue because I use record data to store my form data.
You could add a a check to the value parameter
if(ri!id < 1, null, ri!id)
If the variable is of type integer and is parameter, by default 0 will be stored. As Stefan mentioned, you need to check or(isnull(pv),pv!value=0)