in the community, we have a standard detail page where we want to restrict customer to update the status field what we have done until are following.

  1. CSS by a hierarchy of dom inside aura HTML but failed when the client changed the position of the field.

  2. we tried on inner HTML

    var elements = document.getElementsByClassName("uiPicklistLabel"); console.log(elements); for(var x=0; x < elements.length; x++) { console.log(elements[x]); if(elements[x].children[0].innerHTML="Status"){ console.log(elements[x].children[0].innerHTML); elements[x].nextSibling.classList.add("statusactivecss"); } }

and add CSS to added class.

it's working fine while direct use in the console but in ltng:require scripts= DOM change later when we click edit and again fail to hide any suggestion related to this


  • I may be misunderstanding, but can you not make that "Status" field read only for the community profiles? – Kris Goncalves Jan 9 at 13:46
  • @KrisGoncalves I want to restrict some field for any profile to update – sfdc Jan 10 at 5:19

You cannot make read-only the status field to Community Users and any other profile as well as you cannot remove it from a Page layout. One Way is that you can write a validation rule based on the Community User profile and restrict that user from changing the value.

The validation rule can be something like that.

ISCHANGED(Status) && $Profile.Name = 'Community Profile Name'

If you want to allow certain statuses while creating a new case you can add that exception as well like, let's say you want to allow the new case can only have 'New' status when it is created by a community user, you can tweak the validation rule like below.

$Profile.Name = 'Community Profile Name' && ((ISNEW() && !ISPICKVAL(Status, 'New')) || (!ISNEW() && ISCHANGED(Status) ))
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.