In certain special scenarios, you want to only execute macro logic if a specific item exists 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" exists 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)
try |
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 exists:
Item does not exist:
Comments
1 comment
Hello,
Thanks for the example. What if I need to check column if exist on the matrix?
For examle: I would like to check if ItemCode is visible on sales order line matrix.
Morten Lilbæk Pedersen,
Rasmus Jensen
Please sign in to leave a comment.