The community will be in read-only from Monday 11:59pm (PT) to Wednesday 7:30am (PT)
The community will be in read-only from Monday 11:59pm (PT) to Wednesday 7:30am (PT)
Service Desk Practitioners Forum
cancel
Showing results for 
Search instead for 
Did you mean: 

How to prevent users to change search code...

SOLVED
Go to solution
Highlighted
Alain_18
Regular Collector

How to prevent users to change search code...

Hi,

Does anyone know how to prevent users to change a CI's search code when the ID field is not empty
10 REPLIES
George M. Meneg
Honored Contributor

Re: How to prevent users to change search code...

Hello Alain,

What is your SP level? Because if it is SP17 and after this won't work:

Create a UI rule that will be evaluated before the item is changed. At the conditions enter "ID is not empty" and "Searchcode" is not empty. As action enter a "User notification message" of Error type. This message should display "You are not allowed to change the searchcode for existing items" or something similar.

After the action press "< Back" and go to the first page. There change the evaluation condition to "When a value has changed". Go to second page and select the "Searchcode" condition. Mofify it to "Is Anything" and check "Evaluate condition when this field has been changed". Press "Next >", "Next >" and save the rule.
menes fhtagn
Mark O'Loughlin
Honored Contributor
Solution

Re: How to prevent users to change search code...

Hi Alain,

could be a number of ways.

You could use a UI rule to write the searchcode value to a hidden text field that the users cant see or write to. This rule would fire when the record is opened and ID is not empty

On close you could write the value back. Though if a user thinks they have changed the value and it reverts back to the original they could get confused. You could add a user pop up to tell them what happened and why - that they cannot change the value.

You could have a check box underneath the search code that if checked wil allow someone chaneg the search code and assign write access this to say the Config Manager role. This would be part of the condition in the original UI rule above
George M. Meneg
Honored Contributor

Re: How to prevent users to change search code...

If you are on SP17 or greater then create the rule and check only "When a value has changed".

As action you cannot have "User notification message" however you can update a custom boolean.

Then create a second db rule that will be executed before the item is saved. It will check if the custom boolean is true and if this is the case display a user notification message of error type.

Hope that helps.
menes fhtagn
Alain_18
Regular Collector

Re: How to prevent users to change search code...

Hello George,

We have SP13.

I have this rule but it just displays the notification and don't prevent the user to go ahead and save the item with the changed value.
Michel SILVA SO
Occasional Visitor

Re: How to prevent users to change search code...

Hi Alain,

have found a seamless request with a little tutorial. (See attached file on the link)

http://forums1.itrc.hp.com/service/forums/questionanswer.do?threadId=1050064

Hope this helps.
Rgds,
Michel
George M. Meneg
Honored Contributor

Re: How to prevent users to change search code...

OK, follow the second path (the one with the custom boolean).

If the message type is error it won't allow user to save the record. The drawback is that even if it puts the original searchcode back in place it won't allow the user to save the record.

The best thing to do is what Marc advised. Create a shadow copy of searchcode when item is opened and before is saved, if the copy differs from the original don't allow user to save the record by issuing an error message.
menes fhtagn
Alain_18
Regular Collector

Re: How to prevent users to change search code...

The message type is error and still the user can save changes.
See my rule in the attachment, maybe something wrong.
Mark O'Loughlin
Honored Contributor

Re: How to prevent users to change search code...

Hi Alain,

try switching the evaluate this rule setting to evaluate thsi rule when not ID is empty instead of what you currently have.
Alain_18
Regular Collector

Re: How to prevent users to change search code...

Thank you everyone,

I've dropped my UI rule and adopted Mark's shadow field.

Alain_18
Regular Collector

Re: How to prevent users to change search code...

Bye
//Add this to "OnDomLoad" event