workflow condition check if field empty

Nawal
Mega Guru

hi,

I need to check if a table’s field  is empty to decide how many approvals the request should have.

the table : 

find_real_file.png

the form :

find_real_file.png

On the form, user chooses a BLI. 

A script retrieve Sector and other informations form the table.

what i need to do :

if the sector of the BLI don’t have an approval mentioned in the table, we return : NO

if the sector of the BLI choosen have a approver filled in , we return  yes

u_bli_approval_group is a reference field (sys_user)

the script i m trying to do : 

var appro = current.variables.filiere.u_bli_approval_group.getDisplayValue();

 ifScript();

function ifScript() {

                           if (appro != null) {

                               return 'yes';

                }

                else {

                               return 'no';

                }

}

 

thank you for your help

1 ACCEPTED SOLUTION

Ankur Bawiskar
Tera Patron
Tera Patron

Hi,

so you need to query that table or if that variable refers that custom table you can directly dot walk

try this

ifScript();

function ifScript() {

	var appro = current.variables.filiere.u_bli_approval_group;
	if (appro != '') {
		return 'yes';
	}
	else {
		return 'no';
	}

}

Regards
Ankur

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

View solution in original post

2 REPLIES 2

Ankur Bawiskar
Tera Patron
Tera Patron

Hi,

so you need to query that table or if that variable refers that custom table you can directly dot walk

try this

ifScript();

function ifScript() {

	var appro = current.variables.filiere.u_bli_approval_group;
	if (appro != '') {
		return 'yes';
	}
	else {
		return 'no';
	}

}

Regards
Ankur

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

thank you Ankur.

It wotks 🙂