Visual studio code for standard variable name

Hi Team,

I need a visual studio which is created for standard variable naming.
For Ex:- for String variable it should start with str_Variable name
for int variable it should start with int_Variable name
for Dictionary variable it should start with Dic_Variable name
for boolean variable it should start with bool_Variable name
for Datatable variable it should start with DT_Variable name
for Date variable it should start with Date_Variable name

Regards,
Swetha

Hi @Swetha_MR

Can you elaborate your query?, you need a robot to change the existing variable name into standard names like you said?

Regards
Sudharsan

Hi Sudharsan,

I need to write a code for workflow analyzer in the visual studio for the above variable names.
Bot should through an error if the user is creating a variable other than the above variable format.

Regards,
Swetha

Hi Team,

Can someone help me on this.

Regards,
Swetha

Checkout the guide at Building Workflow Analyzer Rules

In the Inspect() function, you will need something like this to check the variable name:

        foreach (var activityModelVariable in activityModel.Variables)
        {
            var type = activityModelVariable.Type.Split(',')[0];

            if (type.Equals("System.String"))
            {
                if (!activityModelVariable.DisplayName.StartsWith("str_"))
                    messageList.Add($"The variable {activityModelVariable.DisplayName} is of type String should start med str_");
            }
            else if (type.Equals("System.Boolean"))
            {
                if (!activityModelVariable.DisplayName.StartsWith("bool_"))
                    messageList.Add($"The variable {activityModelVariable.DisplayName} is of type Boolean should start med bool_");
            }
        }