Hi All …
I have a use case where I need to retrieve description of a dynamic entitlement and then email it to the user. The description is the network file share path. The description text varies as some entitlements’ description do have “ITSM-12345” text at the start and some don’t have it. For example;
- ITSM-12345-\\network file share path
- \\network file share path
The ‘ITSM’ text is a static value but the integer part (e.g 12345 or 67894) is a dynamic value, so here I can’t use ‘Replace’ operator to replace ‘ITSM-12345’ with some other text or output. The aim is to email description of entitlement (network file share path) but without “ITSM-12345” part if it has it.
Proposed Solution:
Step1: Use ‘Get Index’ operator to find the location of double backslashes (\\) where the network file share path starts. After lots of testing, I found that ‘Get Index’ operator doesn’t work as expected. I’ve already created another post about this. Workflow - Issue with ‘Get Index’ Operator in Define Variable Operator
Step2: Once the ‘Get Index’ operator issue is resolved, then use ‘Substring’ operator within Define Variable to retrieve the desired text i.e only return the network file share path (without the ‘ITSM-12345’). After some testing, I found I can’t get the desired result because of the below scenarios.
Note: The description length is unknown.
Use case1 - (where network file share path doesn’t have ‘ITSM-12345’ text at the start and the path starts with double backslashes)
start value: 0
Length value: blank as it’s unknown (dynamic)
Output result: blank/null value (not getting the desired outcome)
Use case2
Start value: 0
Length value: 100 (if this value is greater than expected length value, then workflow throws an error saying invalid length provided as shown in attached screenshot). If it’s less than the expected length value then it doesn’t return full path i.e some text is missing at the end as expected.
Output result: Not getting the desired outcome
Use case3
Start value: 1 or 2 or any other integer except 0
Length value: blank as it’s unknown (dynamic)
Output result: Getting the desired result (but this option doesn’t work if network file share path starts without ‘ITSM-12345’ text at the start i.e start value is 0 as explained above in use case1).
I am not sure if it’s possible for the Workflows support team to make the Length value optional i.e if it’s blank then returns full text regardless the start value is 0 or or any other integer.
OR, please let me know if the above can achieved in a different way.
Thanks