Restrict to run code if particular string found

Hi , i need an existing rule or custom rule to find the particular string in project . example
need a rule to find “\server” string and throw error.

Hey @BIJU_PANKIRAJ
You can use this to see
boolVariable = result.Contains(“\Server”). this will return a boolean value
Next in if condition activity you can throw a system exception so that code won’t continue

Hope this will help.
Cheers.

1 Like

Hi @BIJU_PANKIRAJ

How about the following?
image

New BusinessRuleException("exception")
strInput.Trim().ToUpper().Contains("\SERVER")

Regards

1 Like

Hi Divakar ,thank you for suggestion. I think I did not explain correctly . what I need is a workflow analyzer rule (custom or predefined one ) which check the code containing specific string (example \servername) .

From server admin side , we do not want (example) server name to be included in the code by developers.

@BIJU_PANKIRAJ
This might be helpfull

https://docs.uipath.com/developer/other/latest/developer-guide/building-workflow-analyzer-rules

Cheers,

1 Like

predefined rules do not help me

Refer this

Cheers.

2 Likes

thanks . it helped me to develop custom rule.