Skip to main content
yeskay
Bronze ⭐️⭐️⭐️
August 9, 2020
Solved

How to access the updateattributes inside groovy script


I have a custom variable in Updatedate processor( state = success), now i want to access those variable in my groovy script which is in invokescriptor processor.

def status= flowFile.getAttribute('status')

i tried below mentioned both syntax as well

Attemp1:
if( status.equals("success")){
//
}


Attemp 2:
if(status == "success"){

}

the above 2 attempts flowFile.getAttribute('status') returnning null value.

Please correct my mistake!

SagarKanani
Gold ⭐️
August 20, 2020

You need to provide more information here...Is Updatedate processor an Updateattribute processor? What does invokescriptor processor do? Are you storing an attribute called state or are you using the processor's state?

Assuming its just a variable in flowfile, your attempt 2 should work.

 

Hope this helps. If the comment helps you to find a solution or move forward, please accept it as a solution for other community members.

1 reply

SagarKanani
Gold ⭐️
August 20, 2020

You need to provide more information here...Is Updatedate processor an Updateattribute processor? What does invokescriptor processor do? Are you storing an attribute called state or are you using the processor's state?

Assuming its just a variable in flowfile, your attempt 2 should work.

 

Hope this helps. If the comment helps you to find a solution or move forward, please accept it as a solution for other community members.

Translate