cant nominate twice within the same month

Andyj00
Tera Contributor
I have a record producer called 'rap it' that writes directley into 'x_mscrs_rap_it_x_rap_it_award' table.

In the record producer form there is field submitter_rc that auto populates with the current user, field created_time that auto populates with the current date, and nominee_rc which the submitter can choose.

These fields save in the rap it x table under fields submitter, created_time, and nominee.

Now I need the record producer form in the mobile portal where the user is submitting the information to pop up a message and erase the nominee_rc field if the submitter trys to choose the same nominee within the same month if they had previously nominated them.

For example, submitter_rc X cant choose nominee_rc Y in month B because they had done so already.
 
2 REPLIES 2

Ademir Amaral1
Kilo Sage

Hi @Andyj00 

 

To implement this functionality in the mobile portal for your ServiceNow record producer, you would need to create a Business Rule that runs when the record is inserted or updated in the x_mscrs_rap_it_x_rap_it_award table. Here are the general steps you can follow:

  • Create a new Business Rule that runs on the x_mscrs_rap_it_x_rap_it_award table. Set the 'When to run' field to 'Before' and the 'Insert' and 'Update' checkboxes to 'true'.
  • In the Business Rule script, you will need to query the x_mscrs_rap_it_x_rap_it_award table to check if the current user has already nominated the same nominee in the current month. You can do this using a GlideRecord query that filters on the submitter_rc and nominee_rc fields, and uses a date filter to check if the nomination was made in the current month.
  • If the query returns any results, it means that the user has already nominated the same nominee in the current month. In this case, you can use the GlideForm API to display a message to the user in the mobile portal, and clear the value of the nominee_rc field to prevent the user from submitting the same nomination again.
  • If the query does not return any results, it means that the user has not nominated the same nominee in the current month, and the nomination can be submitted as usual.
  • Save the Business Rule and test it in the mobile portal to ensure that it is working as expected.

Overall, this approach uses a Business Rule to enforce the business logic that prevents users from nominating the same nominee in the same month. The GlideForm API is used to display a message to the user and clear the nominee_rc field if necessary.

 

If my answer has helped with your question, please mark my answer as accepted solution and give a thumb up.

 

This is what made for the business rule yet nothing happens, any suggestions?

Thank you.