In certain special scenarios you want to only execute macro logic if a specific item exist on the form.
Macro by default does not have any "DoesItemExist" function but we can create our own using .NET code.
We want to check if the item "Foreign Name" exist on the Business Partner Master Data window.
Step 1) is to find the item uid of the item we want to check (You can use the right-click for this):
Step 2) is to create the .NET code function
This is done by opening the UF - Macro and using right-click to open .NET code:
Step 3) Write the code to check for the item and return a result (Replace 128 with your item code)
Step 4) Use the .NET code in the macro:
IF(@ForeignNameExist = 'true')
Step 5) Test that it works (I have used a Function Button)
Item does not exist: