Restrict Special Characters using Sage Intacct Smart Rules

By | February 10, 2021

Sometimes we might face a scenario where we find the need to prevent users from entering special characters in some fields. For example we want to restrict users from using the “%, &, @” characters in the Bill ‘Description’ field.

As we know we can use Smart Rules to add user based validations to the standard screens. They allow us to write run-time validations. Using Smart Rules, we can ensure that the standards of our business processes are achieved.

Sage Intacct allows us to use string methods for validating string inputs.

  • strtolower(parameter) : To return the string in lowercase.
  • strtoupper(parameter) : To return the string in Uppercase.
  • strlen(parameter) : To return the length of string.
  • substr(parameter,start,[length]) : To return a substring whose length starts from the character at the position provided as start and goes upto the length of characters mentioned. Length is the end of string if not mentioned.
  • right(parameter,length) : To return a substring starting from the character at position provided as length, counting from end of the string.
  • left(parameter,length) : To return a substring starting from the character at position provided as length, counting from the beginning.
  • strstr(parameter,token) : To check if the substring/token is present within the string. For checking case sensitivity as well use stristr(parameter,token).

We can use strstr(parameter, token) methodwithin Smart Rule condition for preventing special charactes. This method returns a Boolean value (true/ false) based on if the mentioned token exists within the parameter string. Make sure to write strstr all in lowercase as the method strstr() is case-sensitive.

Follow the steps below:

  1. Add a new Smart Rule on the desired object (e.g: AP Bill) by navigating into Platform services.
  2. Select Events Add and Edit. Choose the message type as “Error”.
  3. Write the following condition and Save.

    Smart Rule
  4. Now add a bill to check how our validation is working. Fill in the desired details and mention any or all of %, & and @ symbols in the description field and then click Post.

    Add Bill

    Above error is displayed thus restricting Users from entering %, &, @ characters in Description field. All other special characters are allowed though.

This way using a Smart Rule we can easily validate the Bills to check if the Users bide by the characters we want to allow in Description field.