Find your people. Pick a challenge. Ship something real. The CreatorCon Hackathon is coming to the Community Pavilion for one epic night. Every skill level, every role welcome. Join us on May 5th and learn more here.

unable to set the value for a field

lakshman nalla
Tera Contributor

hi all,

 

i have below requirements. based on the http status i need to set a value for a field. if it is 200 we need to set state to closed complete and set the flag to true so below is the script

 current.flag = false;
        if (httpStatus == 201 ||  httpStatus == 200 ) {
            current.state = 3;
			current.flag = true;
            current.update();
            
        } else {
            current.state = 10;
            current.update();
        }

my script is not working for the setting the flag please suggest.

4 REPLIES 4

Vishal Birajdar
Giga Sage

Hi @lakshman nalla ,

 

Can you please let us know , where you have written this code...??

 

 

Vishal Birajdar
ServiceNow Developer

I know one thing, and that is that I know nothing.
- Socrates

hi @Vishal Birajdar  business rule

Hello @lakshman nalla 

 

Ok..Thanks....!!

 

Can you try using setValue() & also check the backend name of 'flag' field.

 

       current.setValue('flag',false);
        if (httpStatus == 201 ||  httpStatus == 200 ) {
            current.setValue('state' ,3);
	    current.setValue('flag',true);
           // current.update();  not to use .update for current object
            
        } else {
            current.setValue('state' ,10);
           // current.update();
        }

 

 

 

Vishal Birajdar
ServiceNow Developer

I know one thing, and that is that I know nothing.
- Socrates

Sandeep Rajput
Tera Patron

@lakshman nalla Are you sure your flag field name is flag? This looks like a custom field to me and custom fields usually start with u_ prefix. Check if your field name us u_flag instead of flag.