cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Fry Chef leah_brooks
Fry Chef

Validation Rule to only work with inline editing

Jump to solution

Hello!  I hope I am conveying this correctly, please feel free to ask me if the below is confusing!

We use ServiceMax in our org to manage cases/etc.  SM comes with it's own suite of buttons that the techs are supposed to use to change the status on their cases.  However, since the inline editting for the 'Status' feild on cases cannot be easily turned off, they were just using the inline edit instead of the SFM buttons from SM to change the status. 

I can't have them doing this however as their are triggers which activate off of the buttons, that don't activate when using inline editting.  I wrote a validation rule to stop them and display a friendly reminder to use the SFM buttons, however I need a way to make an exception to the rule when they use the SFM buttons.  Right now this is my rule:

1AND($Profile.Name = 'SVMX-BR-Service User', ISCHANGED(Status))

I need to add some sort of exception so that it does let the users modify the value of the status feild if they are doing through the SFM buttons...any ideas?  Is there a way to clarify that only inline editting should be locked down?

User-added image

Thanks in advance!

Message 1 of 8
1 Solution

Accepted Solutions
Staff Chef richard_lewis
Staff Chef

Re: Validation Rule to only work with inline editing

Jump to solution

Hi Leah, the second option I shared should work with this.

2 - You can create a new 'SFM Status' field which has the same values as the standard 'Status' field but is populated only by the SFM and not accessible on any page layouts. You can use the SFM to automatically map the value into this field depending on the particular change status SFM the user has selected. Then you can build a Salesforce validation rule to fire if there has been no change in this field but there has been a change in the main status field.  It will then fire every time someone tries to change the status from the browser. You can make your Validation rule profile dependent. You need to consider what the field values are for each status change and may need to write some logic in the validation rule to deal with a work order edit before the first status change.

Existing Field

Name - Status

Picklist values = no change

Browser Page Layout = required

SFM Page Layout for edit and create Case = required

SFM Page Layouts for various status changes = required BUT Mapped to the correct value depending on the status change SFM.

New Field

Name - SFM Status

Picklist values = same as the field 'Status'

Browser Page Layout = Read Only

SFM Page Layout for edit and create Case = Read Only

SFM Page Layouts for various status changes = Read Only BUT The mapping of each of the Status change SFMs sets it to be correct value e.g. Travelling or Arrived or Done. This would match the status value being set in the 'Status' field.

The above assumes you have a different SFM for each status change e.g.

SFM1 = Travel to Customer Status change

SFM2 = Arrive at Customer Status change

SFM3 = Leave Customer Status Change

Your Salesforce validation rules would be something like this logic:

('Status' value is different to previous Status value) AND (('SFM Status' value is blank) OR ('SFM Status' value is NOT EQUAL TO value of 'Status' field))

Validation error will show on SFM or Browser when the above is set to True.

When testing you must list all possible values of both fields before and after the edit and test changing between them.

I hope my logic makes sense. What do you think?

You probably also need to consider how your validation rule will handle a newly created record or is that being done via SFM? In which case you can map the status value to the 'SMF Status' field. Or if it is not created by SFM you may need to exclude a scenario in the validation rule where the status field was blank before and then changed to poulated AND also set a default value for the Status field.

Regards, Richard

~If my post was useful, please give me a thumbs up! Mark correct answers as 'solutions' so we can all find answers faster!~
Message 4 of 8
7 Replies
Staff Chef richard_lewis
Staff Chef

Re: Validation Rule to only work with inline editing

Jump to solution

Hi Leah,

I see two options to resolve this:

1 - Create a new page layout. You would only give this to the Salesforce Profiles you wanted to force to use the SFMs to change Status. You could make the field 'Status' read only on the Salesforce Page Layout and on your edit SFM and only leave it as non read only on the SFM to change Status. If you haven't already you can add criteria to the SFMs for changing status to only show then when the work order has the previous status in the sequence. This option introduces an extra page layout which is a maintenance overhead so it is not my preferred option.

2 - You can create a new 'SFM Status' field which has the same values as the standard Status field but is populated only by the SFM and not accessible on any page layouts. You can use the SFM to automatically map the value into this field depending on the particular change status SFM the user has selected. Then you can build a Salesforce validation rule to fire if there has been no change in this field but there has been a change in the main status field.  It will then fire every time someone tries to change the status from the browser. You can make your Validation rule profile dependent. You need to consider what the field values are for each status change and may need to write some logic in the validation rule to deal with a work order edit before the first status change.

Sorry for taking a while to share this with you. I tried to write a reply on my Phone, when I first saw your post, but needed to write a long post and haven't been able to tear myself away from the day job until now.

Let us know if the above options work for you or if you have follow up questions.

Regards, Richard

~If my post was useful, please give me a thumbs up! Mark correct answers as 'solutions' so we can all find answers faster!~
Message 2 of 8
0 Likes
Fry Chef leah_brooks
Fry Chef

Re: Validation Rule to only work with inline editing

Jump to solution

Hello Richard, and thank you for the response!

I have tried both of those methods, unfortunately, as the case Status field is a mandatory SF field, it cannot be removed from the page layout, or be changed to ‘Read Only’. The only way that I have found to lock it down is through a validation rule that kicks back an error when the user tries to save the page. However when I use this method the SFM also errors out when I try to save correctly.

I am looking for a way that I can somehow exclude the SFM from the validation rule, or another way to do this that I’m just not thinking of!

Message 3 of 8
Staff Chef richard_lewis
Staff Chef

Re: Validation Rule to only work with inline editing

Jump to solution

Hi Leah, the second option I shared should work with this.

2 - You can create a new 'SFM Status' field which has the same values as the standard 'Status' field but is populated only by the SFM and not accessible on any page layouts. You can use the SFM to automatically map the value into this field depending on the particular change status SFM the user has selected. Then you can build a Salesforce validation rule to fire if there has been no change in this field but there has been a change in the main status field.  It will then fire every time someone tries to change the status from the browser. You can make your Validation rule profile dependent. You need to consider what the field values are for each status change and may need to write some logic in the validation rule to deal with a work order edit before the first status change.

Existing Field

Name - Status

Picklist values = no change

Browser Page Layout = required

SFM Page Layout for edit and create Case = required

SFM Page Layouts for various status changes = required BUT Mapped to the correct value depending on the status change SFM.

New Field

Name - SFM Status

Picklist values = same as the field 'Status'

Browser Page Layout = Read Only

SFM Page Layout for edit and create Case = Read Only

SFM Page Layouts for various status changes = Read Only BUT The mapping of each of the Status change SFMs sets it to be correct value e.g. Travelling or Arrived or Done. This would match the status value being set in the 'Status' field.

The above assumes you have a different SFM for each status change e.g.

SFM1 = Travel to Customer Status change

SFM2 = Arrive at Customer Status change

SFM3 = Leave Customer Status Change

Your Salesforce validation rules would be something like this logic:

('Status' value is different to previous Status value) AND (('SFM Status' value is blank) OR ('SFM Status' value is NOT EQUAL TO value of 'Status' field))

Validation error will show on SFM or Browser when the above is set to True.

When testing you must list all possible values of both fields before and after the edit and test changing between them.

I hope my logic makes sense. What do you think?

You probably also need to consider how your validation rule will handle a newly created record or is that being done via SFM? In which case you can map the status value to the 'SMF Status' field. Or if it is not created by SFM you may need to exclude a scenario in the validation rule where the status field was blank before and then changed to poulated AND also set a default value for the Status field.

Regards, Richard

~If my post was useful, please give me a thumbs up! Mark correct answers as 'solutions' so we can all find answers faster!~
Message 4 of 8
Fry Chef leah_brooks
Fry Chef

Re: Validation Rule to only work with inline editing

Jump to solution

Ahh, now I see what you are saying.

So when the SFM is modified it updates ‘Status’ and ‘Status_1__c’’

Whenever the ‘Status’ field is updated it looks to see if the ‘Status_1__c’ field is equal, if it’s not it fires the error.

Thank you for the idea, I will look into this!

Best,

Leah Morgan

Development Specialist

Message 5 of 8
Staff Chef richard_lewis
Staff Chef

Re: Validation Rule to only work with inline editing

Jump to solution

Hi Leah, great news. Let us know how it goes.

Regards, Richard

~If my post was useful, please give me a thumbs up! Mark correct answers as 'solutions' so we can all find answers faster!~
Message 6 of 8
Fry Chef leah_brooks
Fry Chef

Re: Validation Rule to only work with inline editing

Jump to solution

So in case anyone else ever has this issue, here is exactly what I did (this has been tested now and is working well on both mobile and PC)

1. Create a new field called 'Case Status' or something similair.

2.  Replace the original 'Status' field with your new status field on all SFMs.  If you have any validation rules on the SFMs, fix those as well.

3. Create a new validation rule that locks down the status on the case if 'Status' does not equal 'Case Status'.  This is what I used: AND($Profile.Name='sample profile',ISCHANGED(STATUS),NOT(ISCHANGED(Status_1__c))).

4.  Create a new workflow for each of you different status' that looks like this: Case:Case Status='Sample Status'.  Have the action be populating the 'Status' field with the same status as is in the Case Status field.

5.  Make sure to activate everything!

Hope this helps someone else, thanks again to Richard Lewis for giving me the idea!

Leah

Message 7 of 8
Retired

Re: Validation Rule to only work with inline editing

Jump to solution

This is awesome! Thanks for coming back and sharing this information.

Message 8 of 8