- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Tuesday
I have a variable set attached to 1 catalog item and there is flow designer that is integrated with othe 3rd party for 2 catalog items. i have variable which might have value for that variable set sometime but sometime it might be empty. so the code is failing to concatenate both arrays of both MRVS if 2nd one is empyt or is not present in catalog item because it is being shown based on need using UI policy. please advase what should we do to combine both arryas if MRVSJSON1 is empty or undefined in below code. right now flow designer is throwing inexpected error if we have mrvsjson1 as empty or not present in catalog item because of which payload is not getting sent over for 1st MRVS even if it has a value.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Wednesday
can you give me your business requirement and explain in detail what's required?
I assume this is what you want
-> 2nd MRVS or 1st MRVS if empty should not be appended
💡 If my response helped, please mark it as correct ✅ and close the thread 🔒— this helps future readers find the solution faster! 🙏
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Wednesday
Hi @Ankur Bawiskar the business reuiqrement
there are 2 mrvs , - for laptop and peripheral bundle, 2nd - addtional monitor. 1st one will never be emtpy as it is present on both catalog items. 2nd one is present only on 1 catalog item so there are chances that it not present and value also will not be there.
so we need to append both in ordervariable1 in both cases. the code should work in either of the case.
Thank you in advance for your help on this!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Wednesday
then here is the working logic, now you can incorporate it in your code
var mrvs1 = current.variables.mrvsVariableSet1NameHere;
var mrvs2 = current.variables.mrvsVariableSet2NameHere;
if(mrvs2 && mrvs2 != ''){
// then only append 2nd mrvs
}
💡 If my response helped, please mark it as correct ✅ and close the thread 🔒— this helps future readers find the solution faster! 🙏
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Wednesday
Thanks only additional check of mrvsJson1 != 'undefined' was required because it was coming as undefined wherever the variable itself was not present