Expand my Community achievements bar.

Guidelines for the Responsible Use of Generative AI in the Experience Cloud Community.

ALC - Java Scripts - Hiding Logic - Presence

Avatar

Level 2

Hi All,

I have a form which has multiple insertion points and the fragments are stitched dynamically. Also this form has some non fragmented part or static parts.

The fragmented part/insertion points will be handled from workbench and for static parts we are handling from using initialize/DocReady event in script to hide / show the section.

Eg of script - Event - Initialize/Docuready

If (A=B)

{

     Subform.presence = "hidden";

}else Subform.presence = "visible";

Problem - These Hide/ Show logic is working well in design time ie only using designer preview when the data is passed from form properties/preview

                  BUT this logic is not working when its run time using Workbench process.

                  Can anybody help me with there inputs ? why the logic is not working when processed with process in workbench and working perfect in designer ?

Any other methods ways i can handle the static parts for my requirement to handle some sections to show and some to hide for diff variations.

Thanks in advance.

Regards,

Abhilash

1 Reply

Avatar

Level 10

I don't use Workbench, however, the script your provided can't work, because it uses the wrong operator for comparing A with B.

Try

Subform.presence = A === B ? "hidden" : "visible";

or

if (A === B) {

    Subform.presence = "hidden";

} else {

    Subform.presence = "visible";

}