Forum Discussion

LaxmikantB2's avatar
LaxmikantB2
Copper Contributor
Feb 06, 2023

can we skip spfx field customizer to render for a particular row if my condition satisfies

I have created a field customizer which basically masking the value in fieldA(It is a required field) by taking values from fieldB. Everything is working fine except if my fieldA and FieldB both have empty value then the end user is not able to see the Sharepoint mandatory column style like below

I have used return statement but its not working. Given below the logic of my code:
if(!fieldA){
return;

//Here I want no rendering at all and show the default style as shown in picture but it is coming as blank
}
else if (fieldB == null || typeof fieldB =="undefined" || fieldB=="" || String(fieldB).trim().length ==0) {
event.domElement.innerHTML=fieldA?.Label;
}

//in this condition I am checking if fieldB is null in that case I am keeping the original value is fieldA as no masking required
else {
event.domElement.innerHTML=`<div>${fieldB}</div>`;

//In this case I am masking fieldB value in fieldA where both have values
NanddeepNachan 

1 Reply

  • Yes, you can skip the SPFx field customizer to render for a particular row by using an if condition as you have mentioned in your code. The 'return' statement will stop the execution of the code and the customizer will not render any changes for that particular row.

Resources