Selecting required for a field and rendering conditions are not working

  • 1
  • Question
  • Updated 3 months ago
  • In Progress
Use Case : I want a field to be required if user with specific profile is trying to create a new record. I added rendering condition to for the field and I have required.

This field is throwing an error when the user not specified in the rendering condition tries to create a new record.

How can I make this work?
Photo of Jaiti

Jaiti

  • 352 Points 250 badge 2x thumb

Posted 3 months ago

  • 1
Photo of Mark DeSimone

Mark DeSimone, Official Rep

  • 11,680 Points 10k badge 2x thumb
Hi Jaiti,

One option is to set up two copies of your field to the field editor or table, and click on one in your field editor or table, and make it 'required.' Then, only render that version of the field for profiles that MUST fill out this field, and render the other version for profiles that are not any of the above. I've tried this out and it seems to be behaving as expected. 

I've set up an example page to demonstrate, with the page's XML below. Let me know if this helps!

<skuidpage unsavedchangeswarning="yes" personalizationmode="server" showsidebar="true" useviewportmeta="true" showheader="true">
    <models>
        <model limit="20" query="true" createrowifnonefound="true" datasource="Ui-Only" processonclient="true" id="UI-Model">
            <fields>
                <field id="MyField" displaytype="TEXT" label="MyField"/>
                <field displaytype="BOOLEAN" id="MakeMyFieldRequired" label="Make MyField Required?" ogdisplaytype="TEXT"/>
            </fields>
            <conditions/>
            <actions/>
        </model>
    </models>
    <components>
        <basicfieldeditor showheader="true" showsavecancel="true" showerrorsinline="true" model="UI-Model" uniqueid="sk-38Aj-443" mode="edit">
            <columns>
                <column width="100%" uniqueid="sk-38Aj-439">
                    <sections>
                        <section title="Section A" uniqueid="sk-38Aj-440" collapsible="no">
                            <fields>
                                <field uniqueid="sk-38Aj-445" id="MakeMyFieldRequired">
                                    <renderconditions logictype="and" onhidedatabehavior="keep"/>
                                    <enableconditions/>
                                    <label>Check this box to make "MyField" required</label>
                                </field>
                                <field uniqueid="sk-38Aj-444" id="MyField" required="true">
                                    <renderconditions logictype="and" onhidedatabehavior="keep">
                                        <rendercondition type="fieldvalue" operator="=" enclosevalueinquotes="false" fieldmodel="UI-Model" sourcetype="fieldvalue" field="MakeMyFieldRequired" value="true"/>
                                    </renderconditions>
                                    <enableconditions/>
                                </field>
                                <field uniqueid="sk-38Aq-481" id="MyField">
                                    <renderconditions logictype="and" onhidedatabehavior="keep">
                                        <rendercondition type="fieldvalue" operator="!=" enclosevalueinquotes="false" fieldmodel="UI-Model" sourcetype="fieldvalue" field="MakeMyFieldRequired" value="true"/>
                                    </renderconditions>
                                    <enableconditions logictype="and"/>
                                </field>
                            </fields>
                        </section>
                    </sections>
                </column>
            </columns>
        </basicfieldeditor>
    </components>
    <resources>
        <labels/>
        <javascript/>
        <css/>
        <actionsequences uniqueid="sk-38AV-259"/>
    </resources>
    <styles>
        <styleitem type="background" bgtype="none"/>
    </styles>
</skuidpage>
Photo of Jaiti

Jaiti

  • 352 Points 250 badge 2x thumb
Hi Mark,
I did try this approach of using the same field twice and adding the profile criteria for visibility but this does not seem to work.