How to fetch the value of field in a flow via system property instead of hardcoding?

Amol Pawar
Tera Guru

Hi Experts,

 

I want to check the value of field in my flow using a system property instead of hardcoding. I can do that in a Create a Record Action, using toggle script, but I'm unable to see that script toggle in If flow logic condition.

AmolPawar_0-1767718315852.png

Please refer this ss and let me know how I can use a system property here. 

One thing, I'm unable to see the Get Property action as well in my instance.

 

Thanks in advance,

Amol

9 REPLIES 9

Hi @Anand Kumar P and @Mohammed8 ,

 

Thank you for replying. I'll check that solution which you provided and let you know the updates. And one thing is that to look up record in sys property table, I need to create my flow in global scope right, mine is in custom scope.

 

I'll check and let you know.

Thank you,

Amol

@Amol Pawar 

I won't recommend using Lookup on sys_property which is a system table and will lead to performance issue.

Please use flow variable approach

I shared approach with screenshots.

💡 If my response helped, please mark it as correct and close the thread 🔒— this helps future readers find the solution faster! 🙏

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

Ankur Bawiskar
Tera Patron

@Amol Pawar 

You can use Flow variable as mentioned by @SanjivMeher 

Create flow variable of type True/False

AnkurBawiskar_0-1767776803225.png

 

Just ensure you set that using "Set Flow Variables" flow logic something like this

var arr = gs.getProperty('propertyName').split(','); // this holds comma separated sysIds as string

var createdRecordSysId = fd_data. < step1SysId > ;

if (arr.indexOf(createdRecordSysId) > -1)
    return true;
else
    return false;

AnkurBawiskar_1-1767776856554.png

 

Then use in IF logic as to check if value is true/false

AnkurBawiskar_0-1767776976951.png

 

💡 If my response helped, please mark it as correct and close the thread 🔒— this helps future readers find the solution faster! 🙏

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

@Amol Pawar 

Hope you are doing good.

Did my reply answer your question?

💡 If my response helped, please mark it as correct and close the thread 🔒— this helps future readers find the solution faster! 🙏

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

ManishS14752344
Tera Contributor

Hi Amol,

So for this there can be two options. 

1: You can create a flow variable and store the value there and use it as required.

2: Before your desired step, you can use look up record and fetch the value beforehand.

I personally go with the second approach.

If this works for you, please mark my response as solution.