Saved Search for Photo Field

Viewing 2 reply threads
  • Author
    Posts
  • July 14, 2021 at 4:42 PM #44802

    Andrew C
    Participant

    My Form has a photo field (titled “Picture”). I would like to do a saved search that lists each record that does not have a picture. But when I open the search dialogue, the “Picture” field does not show as one of the options to search by.

    1 – Is this an unusual issue with my From, or
    2 – If it isn’t in fact possible to search attachment fields, is there another way to do this?

    Thanks!!

    July 14, 2021 at 5:49 PM #44803

    Daniel Leu
    Participant

    2 – If it isn’t in fact possible to search attachment fields, is there another way to do this?

    You can use a field script and use following code. This will return 0 if there are no photos and 1 if there is at least one photo. You just need to add the ID of your Picture field.

    function Has_Photo() {
    	let photo_id = 'fld-xxx';
    	let photo = record.getFieldValue(photo_id);
    	
    	if (photo.length > 0){
    		return 1;
    	} else {
    		return 0;
    	}
    }
    
    Has_Photo();
    July 14, 2021 at 6:22 PM #44804

    Andrew C
    Participant

    Fantastic – that works perfectly. Thank you!

Viewing 2 reply threads

You must be logged in to reply to this topic.