• ddot
  • NEWBIE
  • 10 Points
  • Member since 2020

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 2
    Questions
  • 1
    Replies
Hi group, 

Trying to get some help on a validation rule that has me stuck. What I'm trying to do is only allow an update to the Shipping Address, but only limited to three different profiles, and if a certain value is in the pick list. The code below is what I have so far.

AND(
OR(
ISCHANGED(ShippingStreet),
ISCHANGED(ShippingCity),
ISCHANGED(ShippingState),
ISCHANGED(ShippingPostalCode),
ISCHANGED(ShippingCountry),
OR(
NOT(ISPICKVAL( Hierarchy, "Value")),
$Profile.Name <> "ProfileA",
$Profile.Name <> "ProfileB",
$Profile.Name <> "ProfileC"
)))
  • May 15, 2020
  • Like
  • 0
Hi,

I'm trying to write a trigger that will only allow a user in the community to be able to only see a certain list of users they can @ mention. So far I have following but it is not working:

trigger MentionFeedComment on FeedComment (before insert, before update) {

    List<User> listUserPlatform = [SELECT ID, Name FROM User WHERE Profile.Name <> 'ProfileA' OR Profile.Name <> 'ProfileB'];
    List<String> listNameUserPlatform = new List<String>();

    for(User u : listUserPlatform) {
        listNameUserPlatform.add('@'+u.Name);
    }

    for(FeedComment f : Trigger.new) {
    Boolean nameFinded = false;
    for(Integer i=0; i < listNameUserPlatform.size() && !nameFinded; i++) {
        if( f.CommentBody .contains(listNameUserPlatform.get(i)) ) {
            nameFinded=true;
            f.addError('You can\'t use mention');
        }
    }
}
}

Any help to point me in the right direction will be greatly appreciated. 
  • May 13, 2020
  • Like
  • 0
Hi group, 

Trying to get some help on a validation rule that has me stuck. What I'm trying to do is only allow an update to the Shipping Address, but only limited to three different profiles, and if a certain value is in the pick list. The code below is what I have so far.

AND(
OR(
ISCHANGED(ShippingStreet),
ISCHANGED(ShippingCity),
ISCHANGED(ShippingState),
ISCHANGED(ShippingPostalCode),
ISCHANGED(ShippingCountry),
OR(
NOT(ISPICKVAL( Hierarchy, "Value")),
$Profile.Name <> "ProfileA",
$Profile.Name <> "ProfileB",
$Profile.Name <> "ProfileC"
)))
  • May 15, 2020
  • Like
  • 0