This is a bit of a strange business requirement but a customer was storing IP addresses in there CRM system & they needed to create a view which sorted the IP Addresses.We decided the easiest way was to pad the IP Address with zeros & place the result into a new field so we could sort on that field.
So in the example below we can see the following transformation,
220.127.116.11 -> 009.045.004.255
N52 Formula Manager Solution
The Formula Manager solution works like this,
- We create a formula of type 'Save - To Current Record' for the Account entity
- This formula will be executed whenever the IP Address field changes or gets created initially
- The formula checks to make sure that the IP Address is in the correct format by ensuring it has 3 periods
- It then splits the IP Address up into 4 parts by using a period
- For each part it pads it out with zeros
- Finally the result is placed in a new field called IP Address (Sort).
N52 Formula Manager Steps
- Create a new formula of type 'Save - To Current Record'
- Set the Source entity to 'Account'
- Set the Source Property to 'IP Address'
- Set the Target Property to 'IP Address (Sort)'
- Copy & paste the formula below into the formula description field & click save
- You are ready to test
if(CountCharacters([account.new_ipaddress], '.') = 3, PadLeft( Split([account.new_ipaddress], '.', 0), 3, '0') + '.' + PadLeft( Split([account.new_ipaddress], '.', 1), 3, '0') + '.' + PadLeft( Split([account.new_ipaddress], '.', 2), 3, '0') + '.' + PadLeft( Split([account.new_ipaddress], '.', 3), 3, '0') , 'NoOp')
Wizard - CountCharacters
Please see below the wizard you can use to create the CountCharacters() function call used in this formula.
Note to find the value for Equals Value, you will need to go to the Source tab > Account > IP Address
Did you know?
North52 TestShield benefits Dynamics 365 apps testing
Benefits of using North52 TestShield's automated testing framework for Dynamics 365 apps:1. Accelerate Automated Testing
- Enables continuous testing of Dynamics 365 apps with speed and agility
- No-code test designer enables non-developers to build tests
- Better ROI by a reduction in UAT defects and production defects
- Defect prevention at early stages of the project life cycle
- Get fast feedback on the impact of process changes
- Repeatable automated test execution simplifies problem solving
- Quickly resolves failing conditions from complex end-to-end tests
- Broader test coverage and fewer defects released to production
- Reduced risk and faster release cycles through earlier and automated testing
- Lower costs related to complex test environment management
- Reduces time to market by validating builds faster
- Assist in the generation of automated test scripts that are repeatable and extensible
- Detailed analysis of test trace logs enable easy detection of errors to be fixed
- Automation can perform regression tests which ensures system stability while enhancing the application continuously
- No manual operation increases efficiency and quality of testing